Latest VSOS Kernel (3.66) available here

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
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

VSOS version 3.12

Post by Panu »

Hi, all!

Here's a small update of VSOS.
Updates in version 3.12
* Exported the interface for AddSymbol, GetSymbolAddress thus making
the global namespace expandable. Allows sharing symbols such as
functions or variables between different applications (DLLIMPORT).
This update helps with MP3 players and we also need it internally for the nand flash driver we're working on. We're also working on other improvements, such as the FAT file read/write seek support, but this is NOT yet included in this kernel version.

-Panu
Attachments
vside_win32_v229c.exe
VSIDE 2.29c (minor update of 2.29). Windows 32-bit executable. Includes VSOS 3.12 for VS1005G.
(12.06 MiB) Downloaded 815 times
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

VSOS Version 3.19

Post by Panu »

Dear Forum Members,

It's my pleasure to announce the VSOS kernel version 3.19 for testing. There are some major improvements in the kernel and in the tools, as well as a lot of new drivers and libraries for runtime loading.

Nand Flash Driver

Starting from the drivers, Nand Flash (K9F4G) is now supported. The driver comes in two parts: K9F4G.DL3 is the driver proper, it creates the nand flash logical disk. That driver uses the second part of the driver: the NFBADMAP library, which handles the mapping of bad blocks and can also be used to low level format the flash. For more information, see viewtopic.php?f=13&t=1358.

The Nand flash driver is wear-leveling, e.g. it circularly writes to the entire surface of the nand flash. It currently supports SLC flash, but is written so that it's easily modifiable to support also MLC flash - we are currently working on it at VLSI, making it work together with our Reed-Solomon error correction. This version of the driver uses one-bit error correction.

List of loaded libraries and free memory

The first thing to note in the kernel, is that you can now get a listing of loaded drivers and free memory. Start the updated main menu (INIT.AP3) and press Info, you will see:
info1.png
info1.png (5.94 KiB) Viewed 11307 times
The screen indicates that the drivers for the LCD, console, touch panel, stdbuttons, SD card and Nand Flash are loaded. Having loaded those, there is still some 160 kilobytes of free memory (code + data).

30% more program memory for applications

You'll be happy to note that the even with new features added to the kernel, available code memory for drivers and applications has increased from about 64 kilobytes to 84 kilobytes in this kernel version. You'll also see, in the list of loaded libraries, the main menu (INIT) and the program(library) that lists the libraries (LIBLIST). It's a good idea to divide rarely used features of programs into separate libraries, like the liblist.dl3 in this case, to save more memory for those features that are needed all the time. See the source code for INIT for one possible way to call libraries with a very simple method.

Source code for 27 DL3 libraries

And speaking of source codes, a separate zip archive of VSOS 3.19 libraries source code is now published. It contains the source code for 27(!) libraries that extend the functionality of the operating system from those that are already published as VSIDE templates. For most of the libraries, open the .solution file for the library and see the main source file to see a short description of what the library is for and how it should be used.

Unifont International Character Support

The libraries source code also contains various versions of the Unifont font table (UNIFONT.DAT). With the unifont, you can add support for various international character sets, such as Chinese or Korean. Which character set to choose depends on the size of the flash and the size of those libraries that you need for your final product. The smallest unifont font file is included in the /SYS as default, it contains Latin + Chinese and some other character sets. If you need support for Korean characters or a newer set of characters, choose one of the other unifont.dat variants. We can also compile font files with other character sets for you.

New MP3 player demo

One piece of software uses the Unifont renderer so far: An MP3 player example that uses a new StdWidget graphics library. That one is still under development but it can give you some ideas of the types of applications that can be developed under VSOS. Amazing graphics are not the main feature of a SoC with mere 256 kilobytes of RAM, but with careful design, attractive applications for specific purposes can be designed nonetheless. Here's two screenshots of the MP3 player. In the bottom one you can see some Unifont characters rendered.
selectdisk.png
selectdisk.png (7.26 KiB) Viewed 11307 times
CHI4B.png
CHI4B.png (7.04 KiB) Viewed 11308 times
Multi-format decoder support

For music playing, DL3 libraries for decoding AAC, FLAC, MP3, WAV, WMA and Ogg Vorbis are included. These libraries are released only as binaries, the source code is not included.

MP3 and OGG encoding

This release also contains applications that demonstrate MP3 and OGG encoding. The demo AP3's encode from line in (stdaudioin) and write to E:OUTxxxx.MP3. Again, the source code of the applications should be a good example on how to invoke and use these encoder libraries.
mp3enc.png
mp3enc.png (2.67 KiB) Viewed 11266 times
Slave decoder support

From time to time we are asked if the VS1005 can function as a slave decoder for a host microcontroller. To this question we have answered: yes it can, but some software for it needs to be written. We have now included a key piece of such software: a DEVSDI.DL3 library and its source code. This driver creates a logical disk drive, from which you can open an file handle with fopen(). It installs an interrupt receiver for SPI1. When you read from that file, anything that you send to SPI1 with a microcontroller is received by that file handle. This means simply, that you can add, for example, "DEVSDI D" in your CONFIG.SYS and then call any music player, such as "PLAYFILE D:". The devSdi driver creates the disk D: and the PLAYFILE opens a file from that disk (no file name besides D: needs to be given) and plays whatever it receives. You can then stream a file to it from a microcontroller.

Error trapping and tracking

In the depths of the operating system, a new error tracking mechanism is added. Consider for example this simple program which has an error - it tries to call a device without first initializing it:

Code: Select all

/// \file Humbug.c Example to demonstrate error handling
#include <vo_stdio.h>

DEVICE *notInited;

void LetsCrash() {
	notInited->Identify(NULL,NULL,0); // DEVICE CALLED WITHOUT CREATING IT FIRST!
}
void main() {
	LetsCrash();
}
This program, when run (it's loaded as a driver for this demo), produces this output to the UART stderr console:
Driver: HUMBUG... ZeroPtrCall from 17650(0x44f2), i0=0(0x0000).
Offending lib: Humbug:0.16
Function: _LetsCrash+16
You can see that the kernel traps the invalid call to the uninitialized device. You might wonder how this is possible when the processor has no memory protection. It's possible by a clever trick: VSOS keeps the first 16 locations of data RAM zeroed, so all references to methods via the uninitialized object's self pointer (null) resolve to zero. And location zero in instruction RAM contains a trap to kernel function ZeroPtrCall. ZeroPtrCall then tracks the origin of the call, calls LIBTRACE.DL3 to scan which library is loaded to that address and FIND_ERR.DL3 to scan the symbol table of the library file to show from which function the erroneous call was made. This has great potential to help you to find the reasons for any ZeroPtrCall errors you may get.

Available memory tracking

Another nice thing is that I added code to track code memory usage to the GetMemory function. Whenever a new "record high" I memory allocation is reached and less than 4K words of instruction memory is left, a notification like this is sent to the UART stderr console:
IMEM: only 2768w free!
Let's go!

Ok, this should be enough to get you started in testing the release. We also continue to test and develop. This release has been a major test release in anticipation of VSOS 3.20, which should be more like a "final" version for a while. We're still fixing the fat writabe file's seek and append code, we aim to get that nailed down in 3.20. Then it's time to concentrate on apps development for the OS instead of working on the OS itself. So until then, let's keep in touch and please keep those reports of working and nonworking code coming to us!

Sincerely,
Panu
Attachments
VSOS 3.19 Libraries Source Code.zip
VSOS 3.19 Libraries. Contains the executable AP3 and DL3 files and their source code as VSIDE solutions
(3.01 MiB) Downloaded 701 times
vside_win32_v230.exe
VSIDE version 2.30 (Win32 Executable). Contains the source code for VSOS kernel version 3.19
(12.16 MiB) Downloaded 769 times
thomasgds
Senior User
Posts: 57
Joined: Tue 2014-04-15 8:56

Re: Latest VSOS Kernel (3.12) available here.

Post by thomasgds »

Great!!!
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Re: Latest VSOS Kernel (3.19) available here.

Post by Panu »

Hi!

One critical file was forgotten from the 3.19 kernel. If it's not present, the kernel will compile but the kernel will fail when enough applications are loaded, because the loaded applications will overwrite memory.

Please extract file vslink.cmd from this zip to kernel sources to fix the problem.

-Panu
Attachments
vslink.zip
Linker control file to force USB-related functions to higher memory locations.
(480 Bytes) Downloaded 608 times
User avatar
boen
Senior User
Posts: 86
Joined: Fri 2014-09-19 7:22

Re: Latest VSOS Kernel (3.19) available here.

Post by boen »

Hello Panu
Panu wrote: One critical file was forgotten from the 3.19 kernel. If it's not present, the kernel will compile but the kernel will fail when enough applications are loaded, because the loaded applications will overwrite memory.

Please extract file vslink.cmd from this zip to kernel sources to fix the problem.
do you mean that, we just extract file vslink.cmd from this zip, and then copy it to our project.
would you please tell us which directly should we copy to ? thank you!

-boen
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Re: Latest VSOS Kernel (3.19) available here.

Post by Panu »

Hi!

Just copy it to the same directory where the kernel's main.c file is and then recompile the kernel.

-Panu
User avatar
boen
Senior User
Posts: 86
Joined: Fri 2014-09-19 7:22

Re: Latest VSOS Kernel (3.19) available here.

Post by boen »

Dear Panu

Thank you very much!



-boen
Passionate Jaguar
Senior User
Posts: 78
Joined: Sun 2014-05-04 9:17

Re: Latest VSOS Kernel (3.19) available here.

Post by Passionate Jaguar »

Are you going to release an SD kernel for 3.19 soon?

If not, do you have a workaround for mounting the SPI flash with the USBDisk AP3? We need to make software changes by e-mail. We are field testing software in remote locations where unskilled users only have a PC to add revisions as they would with any attached mass storage.

Thanks,

Scott
VS1005 Demo Board v1.8, custom designed VS1005 boards, with VSOS 3.55 - VSIDE v2.43
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Re: Latest VSOS Kernel (3.19) available here.

Post by Panu »

Hi!

We thought to discontinue the SD version because the functionality to show the SPI flash to the PC by USB has been stable for some time now, and we've felt that having the applications in the flash is what most users want. But it's just a few lines' modification to make an SD kernel from the SPI kernel (replace devSpiFlash.c with devSDSD.c and in StartOS init the SD instead of the flash -- oh, and unfortunately a little bit more memory must be allocated to the kernel if SD card is used - modifications to kernel mem_desc and the memory macros in main.c are needed). I can do that for you if you like.

If you can continue with the flash kernel: to show the SPI flash in the USB, press [S1] during boot. Connect PC USB cable to the USB Mini-AB connector. You can take a look at the educational videos, it's done that way in the videos.

If you want to change the functionality - use some other method than [S1] button to decide whether to go to USB or not, look for the VoMassStorage('S') call in main.c

-Panu
Passionate Jaguar
Senior User
Posts: 78
Joined: Sun 2014-05-04 9:17

Re: Latest VSOS Kernel (3.19) available here.

Post by Passionate Jaguar »

Thank you for your considerations. You suggestion for software access to mount S:MassStorage I will work on.

For application program development, I did test the 3.12 Ext SPI Flash and it definitely is more stable and would like to use this now under 3.19 (and 3.20 if we can minimize our interrupts for all of you ;) ). And the product we are developing requires compressed recordings of 15 to 30 minute average with a max of 60 minutes. This makes removable and USB mountable mass SD storage far more practical. So we need USB mountable SPI External Flash for program development and field testing and Mass SD storage for runtime user access.

Pressing S1 for SPI Ext Flash is perfect for in-house testing. For field testing, can S:MassStorage be modified for software USB mounting of either the removable SD Card -OR- mounting the EXT SPI Flash??

Any and all ideas and helpful hints would be greatly appreciated.

Also, have I found a bug in RenderStdButton and myButtonVariable->caption ???

Following Henric's great example in "Simple MP3 Encoder for VSOS3" which I am running very well under 3.12 SD right now, I can create my app display using CreateStdButton and RenderStdButtons(buttons) and RenderStdButton(deckModeButton) either in Main or in a separate function (same .ap3) called from Main. From the same function, rendering an individual button as in Henrik's example works perfectly (and very speedy).

However, if I run the code to update a caption from a function other than where I render all the buttons (still in the same .ap3) as follows:

deckModeButton->caption = "REC";
RenderStdButton(deckModeButton);

The deckModeButton->caption line compiles with the error "ERROR 12: structure or union type expeccted

and the RenderStdButton(deckModeButton) line (with ->caption line commented out) compiles without error but causes my Developer Board v1.8 to lock up when it hits the RenderStdButton line. Is this a register or push /pop problem from being in a different function?? Or is this a "feature" that I need to find a solution to??

Thanks for your assistance during "crunch time."

Scott
VS1005 Demo Board v1.8, custom designed VS1005 boards, with VSOS 3.55 - VSIDE v2.43
Locked