EMBARK/programs
2021-10-10 19:49:24 +02:00
..
.gitignore added threads.h header file for example program 2021-09-30 20:53:01 +02:00
Makefile a lot of cleanup, added pmp 2021-09-30 21:55:28 +02:00
README.md better programs readme 2021-10-10 19:49:24 +02:00
simple.c better programs readme 2021-10-10 19:49:24 +02:00
spawn.c a lot of cleanup, added pmp 2021-09-30 21:55:28 +02:00
threads.c a lot of cleanup, added pmp 2021-09-30 21:55:28 +02:00
threads.h a lot of cleanup, added pmp 2021-09-30 21:55:28 +02:00

EMBARK example programs

Note that these programs are of poor quality.

  • simple.c does some arithmetic in a loop and prints some numbers.
  • spawn.c this programs spawns a new thread and exits when the thread overwrites a value.
  • threads.c this program spawns two threads and waits for them to exit. The threads sleep for some time before exiting.

Compiling

The important thing when compiling user binaries are the following:

  • -mcmodel=medany makes all address loads pc-relative. This allows for relocating binaries without much effort. This only works, if the addresses are larger than signed 12 bit number, so make sure you programs are located far enough into memory. (the default linker script takes care of that)
  • -T ../linker.ld use the kernel linker script. This packs everything nice and close and sets the __global_pointer$ etc up.

If you don't want to worry, use the makefile make all.