I use an board with STM32F407IG (1 MByte of Flash, 192 Kbytes of SRAM) and an SPI Flash AT45DB041 (2MB). My app is about 220KB (and expecting to be bigger in the future), so it has to reside in internal flash. The SPI Flash would use SmartFS and the file would be transferred from PC to it using FTP.
That all sounds good to me.
The OS is Nuttx and the intention is to be able to build the application separated by the OS and be able to update it, without updating the system. I understand that this would require a kernel build and that kernel build is not very stable..
The Kernel build will support separate builds as you suggest. And it also appears stable on the platforms that I have tested with.
However, I would not necessarily recommend the kernel build in your case. The kernel build is used primarily to support security. It divides the flat build into two pieces: A kernel mode blob and a user mode blob. The MPU is then use to protect all of the kernel mode blob resources from the user mode blob.
If you want that kind of protection, then the kernel mode is exactly what you want. If you just want to build the application as a separate, replaceable blob then you don't need to use it. Consider this:
1. You can build the core OS and a loader as a separate NuttX application. Right? Nothing special here. NuttX would boot and start your loader application. The loader application would look to see if there is an application already in FLASH and, if so, it could just jump into it. The loader would have to know about some "magic" addresses where the application lies and you would probably have to have some header at that magic address so that the loader can determine if there is an application present there or not.
2. If there is nothing in FLASH (or, perhaps, if some special buttons are pressed at boot up time), then the loader could copy the application from the AT45 FLASH to the serial FLASH.
Now, how would you build an application in for this case? You would need only to have a special linker script that:
1. Does not include the NuttX startup and vector logic, and
2. Defines all of the symbols in the the base code. The syntax is like:
symbol = expression ;
And you use this a few hundred times to export all of the symbols from the base code. You would probably have to develop a tool that uses arm-none-eabi-nm or the top level System.map file to generate such symbol definitions. Then when you build the new application with this special linker script, it was call into the base code to interface with the RTOS.
An alternative would be to put a big call table in the base code that the application could use to access the base OS code. There are always many different designs that can achieve the same ends.
The only real advantage of the kernel build in your case is that that you can interface with the base code through traps and no such symbol information would be required.
I also have to be able to debug the app, while developing it with Atollic and J-link
I don't think that there is anything unique about this debug environment. If you have all of the symbolic information for that application, it should debug fine until you call into the base code, then you would have to load a different symbol file.
Is it possible (and how?) to build the app separated from Nuttx? Is it possible to update and execute it from internal flash ? Should I do this using /apps/system/install/ for this?
I have not used /apps/system/install, but it seems like it could be the basis for what you want to do.