VS1005 Basic Course

Discussion about writing software for VS1005 and the VSOS Operating System. Also posts about VS1005-related hardware design and device drivers should be posted here.
User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2727
Joined: Tue 2010-06-22 13:43

Modifying the Kernel

Post by Panu » Fri 2012-05-25 17:55

If you modify the version 0.19 kernel, you need to export the kernel symbols and application memory map, and import them to your Application solution.

The following helper script (put it in VSIDE's External Tools) creates an eeprom image and exports the kernel symbols into the parent directory. It will need perl (perl.exe) installed in your path.

Code: Select all

coff2allboot -i vs1005fspi $(TARGETPATH)/$(TARGET) eeprom.img
copy mem_desc.available mem_desc.kernel /Y
vssym -o kernel.sym $(TARGETPATH)/$(TARGET)
perl allsym2abs.pl < kernel.sym > kernel.abs
mkabs -o kernel.o -f kernel.abs
copy mem_desc.kernel .. /Y
copy eeprom.img .. /Y
copy kernel.o .. /Y
The following helper script imports the kernel symbols and memory description into your application solution:

Code: Select all

copy ..\mem_desc.kernel . /Y
copy ..\kernel.o . /Y
You need the matching version of kernel symbols (kernel.o) and the memory map (mem_desc.kernel) to build a working application for VSOS v 0.19. For kernel version 0.19, all applications must be recompiled if you change the kernel. This will be fixed in a later version of the VsOs operating system. Version 0.19 is just to get you started.
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2727
Joined: Tue 2010-06-22 13:43

Re: VS1005 Basic Course

Post by Panu » Fri 2012-05-25 17:55

Thank you very much for attending to the course. Hope to see you again next year!
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

adenisio
User
Posts: 5
Joined: Thu 2011-04-14 3:24

Re: VS1005 Basic Course

Post by adenisio » Wed 2012-06-27 1:51

I would like to reserve a board and samples of vs1005 how can I do, thank you
Last edited by adenisio on Sun 2012-10-28 2:29, edited 1 time in total.

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2727
Joined: Tue 2010-06-22 13:43

Re: VS1005 Basic Course

Post by Panu » Wed 2012-06-27 17:39

I would like to reserve a board and samples of vs1005 how can I do, thank you
The developer boards should be available from the VLSI Solution Webshop in a month or so. They have one VS1005g preinstalled. But it'll probably be several more weeks before we can ship samples. You can write an e-mail to sales@vlsi.fi to register your interest.

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

jedm@vpitech.com
Senior User
Posts: 50
Joined: Wed 2016-11-02 22:50

Re: VS1005 Basic Course

Post by jedm@vpitech.com » Mon 2016-11-28 23:54

Panu:
I need to run a separate task talking to a sensor. So:

1) Add a new task to SysTask to main.c and a new TASK_SENSOR into libvs1005g_vsos3/vsostasks.h or increase the stack size in "Net" or "UI" and use them.
2) Recompile (seems to work).
3) Are the instructions for 0.19 here correct? (Currently running VSOS 3_40)

Jed Marti

Hannu
Senior User
Posts: 79
Joined: Mon 2016-05-30 11:54

Re: VS1005 Basic Course

Post by Hannu » Tue 2016-11-29 8:19

VSOS has evolved quite a lot since 0.19

I wrote some totally untested code how to start a task to the end of this post.
Remember FreeTaskAndStack() after the SensorTask exits to avoid memory leak.
The priority is set same as main task and VSOS switches between tasks in few ticks. If priority was higher than main task, main task would starve if there wouldn't be Yield() calls and vice versa.

Keep the stack size moderate as VSOS needs to allocate memory with same address from X and Y memory.
Program called tasks can print you the max stack usage and that way it is possible to optimize the size.

And word of caution. Now you have one problem to solve. When solving the problem with task you have the problem to solve and all the concurrency problems.

To lock resources, you might be interested in mutex.h and maybe hwlocks.h
To use mutex functions the symbols must be imported to program in VSOS 3.40
See: VSOS_340_RootAndLibrariesSourceCode/solutions/ClassicPlayer/kernelmutex.h

Code: Select all

#include <taskandstack.h>
// Study exec.h, taskandstack.h and the implementation of the functions for greater understanding
TaskAndStack *tas;

void SensorTask(){
	//Read input, process data etc...
	while(1);
}
#define SENSOR_STACK_SIZE 0x100
#define SENSOR_TASK_PRIORITY 1
void SomewhereInInit(){
	tas = CreateTaskAndStack(SensorTask, "Sensor task", SENSOR_STACK_SIZE, SENSOR_TASK_PRIORITY);
}

jedm@vpitech.com
Senior User
Posts: 50
Joined: Wed 2016-11-02 22:50

Re: VS1005 Basic Course

Post by jedm@vpitech.com » Tue 2016-11-29 18:26

Got it. Thank you much.

One additional task required is getting rom1005g.o from main vsos_340 directory and adding it to the linker script so that _AddTask is defined. I get some warnings which I'm ignoring:

Build started. Project: source, configuration: Emulation-Debug

voplinkg -k -m mem_desc_app03.mem -nokeepvisible rom1005g.o C:\Users\jedm\VSIDE/libvs1005g_vsos3/vsos03.o Emulation-Debug\main.o Emulation-Debug\experience.o Emulation-Debug\liststruct.o Emulation-Debug\m3u.o Emulation-Debug\parameters.o Emulation-Debug\playlists.o Emulation-Debug\playstruct.o Emulation-Debug\wpl.o -o Emulation-Debug\source.coff -L. -Llib -LC:\Users\jedm\VSIDE\libvs1005g_vsos3 -lvsos03 -lc -lgeneral -lcodecmpgsmall -lrtossmall

Not importing _Wait because it's already defined absolute 37247 (0x917f) in coff rom1005g.o
Not importing _Signal because it's already defined absolute 37190 (0x9146) in coff rom1005g.o
Not importing _clockSpeed because it's already defined absolute 1828 (0x724) in coff rom1005g.o
Total words: I 2728, X 3421, Y 1.
copy loadable.ap3 source.ap3 /y
1 file(s) copied.

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2727
Joined: Tue 2010-06-22 13:43

Re: VS1005 Basic Course

Post by Panu » Thu 2016-12-01 15:18

Hi!

For VS1005g, AddTask can be declared by the following absolute linking declaration in your C code:

Code: Select all

#include <volink.h>     

// Set absolute location of AddTask in VS1005G ROM. 
CHIPSPECIFIC (VS1005G) LINK_ABS (AddTask,36693)
// Another option would be to include rom1005g.o in linking.
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Post Reply