DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
APPNAME vs. PROGNAME
Q: Both APPNAME and PROGNAME are used to describe the entry point into an application. What is the difference?
A: Let's answer this question by dissecting one case: apps/examples/hello
apps/examples/hello/Kconfig
First, notice in the apps/examples/hello Kconfig file that the PROGNAME is only selected for the kernel build (CONFIG_BUILD_KERNEL). It is not defined or used in other build modes.
...
| Code Block |
|---|
This is the name of the program that will be use when the NSH ELF
program is installed.
|
Kernel Build Mode
What is different about the kernel build mode? In the kernel build, the RTOS is built as a separately linked kernel that lives in its own kernel address space. There are no tasks in the sense used in the flat build. There are still kernel threads but tasks are now referred to as processes: A process is simply a task that lives in its own protected address space.
...
Instead, for the kernel build, the process code must be loaded into memory and mapped into its own address space before it can be executed. The process code is referred to as a program and is typically saved in a file system. If you are familiar with Linux, then then you are familiar with processes and separately linked programs in files.
apps/examples/hello_main.c
Look in the task/process entry point in apps/examples/hello/hello_main.c:
...
When the NuttX program is linked, it is linked with special object called crt0.o. You can see the ARMv7-A crt0 file at nuttx/arch/arm/src/armv7-a/crt0.c.
apps/examples/hello/Makefile
Finally, there are a few interesting things in the hello Makefile at apps/examples/hello/Makefile:
...
| Code Block |
|---|
include $(APPDIR)/Application.mk
|
apps/Application.mk
The final link of each link of each program is performed by the install target in Application.mk:
...
Notice that the final linked programs are stored in INSTALL_DIR which will be apps/bin.
Preparing the File System
The overall build sequency for the kernel build is a little more involved than just typing make. You have to also do some steps in order to create the file system containing the separately linked programs. The following instructions come from nuttx/boards/arm/sama5/sama5d4-ek/README.txt.
...
NOTE the use of the these two special tools:
apps/tools/mkimport.sh
This does the complement of make export in the NuttX directory. make export bundles up all of the OS components for use with some external build. mkimport.sh takes this bundle, installs it in the apps/ directory and performs the build of the separately linked programs.
apps/tools/mkimport.sh
This will (optionally) put the separately linked programs into a ROMFS file system that can be included in system FLASH.