Jamie wrote:For a single core program invoking the front end with -nostdlib is sufficient for the resultant program to contain nothing but user code. For multicore programs the code automatically inserted by the mapper is necessary for correct operation. Thus using --nochaninit will be either a no-op, or cause your app not to work.
But that is assuming you're not setting up channels yourself, in which case it would be useful.
Yes and no. For a single core program there is no mapper generated code so you're free to write a main which allocates channel ends itself. Using --nochaninit has no effect here.
In a multicore situation --nochaninit precludes the use of a multi-core top-level main (i.e. one with "on"s). Thus you'd need some other means of specifying what codes goes on which core. This is non-trivial. If I was doing that I'd generate a series of single-core XEs, and use xobjdump to combine them into a single executable.
For example:
Program for core 0 (file1.s):
Code: Select all
.globl main
.globl _start
.text
.align 2
main:
_start:
ldc r0, 1
stophere:
bu stophere
Program for core 1 (file2.s):
Code: Select all
.globl main
.globl _start
.text
.align 2
main:
_start:
ldc r0, 2
stophere:
bu stophere
Program for core 2 (file3.s):
Code: Select all
.globl main
.globl _start
.text
.align 2
main:
_start:
ldc r0, 3
stophere:
bu stophere
Program for core 3 (file4.s):
Code: Select all
.globl main
.globl _start
.text
.align 2
main:
_start:
ldc r0, 4
stophere:
bu stophere
Compile with
Code: Select all
xcc file1.s -target=XDK -nostdlib -o prog1.xe
xcc file2.s -target=XDK -nostdlib -o prog2.xe
xcc file3.s -target=XDK -nostdlib -o prog3.xe
xcc file4.s -target=XDK -nostdlib -o prog4.xe
Join them together with:
Code: Select all
xobjdump --split prog2.xe
xobjdump prog1.xe -a 0,1,image_n0c0.elf
xobjdump --split prog3.xe
xobjdump prog1.xe -a 0,2,image_n0c0.elf
xobjdump --split prog4.xe
xobjdump prog1.xe -a 0,3,image_n0c0.elf
You can then run prog1.xe on an XDK and observe that each core gets an entirely independent program which consists of nothing but user code.
Jamie wrote:
Right, okay but still pretty brief and no mention of the kind of initialisation code it inserts.
Yes, that's right; this is not documented and I'm not aware of any plan so to do.