2010-12-15 16:33:30 +01:00
|
|
|
ELFloader and shell command 'exec' example for MB851 (STM32W) platform
|
|
|
|
-----------------------------------------------------------
|
|
|
|
|
|
|
|
Compiles the Contiki hello-world application as a Contiki executable (.ce).
|
|
|
|
The Contiki executable is then uploaded to the MB851 platform via serial, and
|
2013-03-26 13:09:49 +01:00
|
|
|
is stored in the filesystem. Finally, the executable is loaded via the shell
|
|
|
|
command 'exec'.
|
|
|
|
|
2010-12-15 16:33:30 +01:00
|
|
|
NOTE:
|
|
|
|
You may have to reduce the ELF loader memory usage (/platform/sky/contiki-conf.h).
|
|
|
|
Since hello-world uses very little memory:
|
|
|
|
#define ELFLOADER_CONF_DATAMEMORY_SIZE 0x100
|
|
|
|
#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x100
|
|
|
|
|
2013-03-26 13:09:49 +01:00
|
|
|
1. Upload Sky shell with 'exec' command and symbols (requires several
|
|
|
|
recompilations to generate correct symbols):
|
2010-12-15 16:33:30 +01:00
|
|
|
|
2013-03-26 13:09:49 +01:00
|
|
|
make
|
|
|
|
make CORE=shell-exec-test.mb851
|
|
|
|
make shell-exec-test.flash CORE=shell-exec-test.mb851 PORT=AUTO
|
2010-12-15 16:33:30 +01:00
|
|
|
|
|
|
|
2. Verify access to the shell and the filesystem:
|
|
|
|
|
2013-03-26 13:09:49 +01:00
|
|
|
> make login DEV=/dev/comX
|
|
|
|
SHELL> echo hello shell
|
|
|
|
SHELL> echo test | write mytest.txt
|
|
|
|
SHELL> ls
|
|
|
|
SHELL> read mytest.txt
|
|
|
|
[CTRL-C] to exit the shell
|
2010-12-15 16:33:30 +01:00
|
|
|
|
|
|
|
3. Upload Contiki executable hello-world.ce:
|
|
|
|
|
2013-03-26 13:09:49 +01:00
|
|
|
> make upload-executable DEV=/dev/comX
|
|
|
|
[CTRL-C] to exit the shell when the entire file has been uploaded (after ~30 sec)
|
2010-12-15 16:33:30 +01:00
|
|
|
|
|
|
|
4. Verify that hello-world.ce exists in CFS:
|
|
|
|
|
2013-03-26 13:09:49 +01:00
|
|
|
> make login DEV=/dev/comX
|
|
|
|
SHELL> ls
|
|
|
|
SHELL> read hello-world.ce | size
|
|
|
|
|
|
|
|
The last command output should equal the size of hello-world.ce in this
|
|
|
|
directory!
|
2010-12-15 16:33:30 +01:00
|
|
|
|
|
|
|
5. Load and start hello world:
|
|
|
|
|
2013-03-26 13:09:49 +01:00
|
|
|
SHELL> exec hello-world.ce
|
|
|
|
|
|
|
|
The program should now start: the output 'Hello, World' appears.
|