Other Parts Discussed in Thread: PRU-CGT
Hi,
I am trying to export compiled code in a c-array that I can flash from ARM-R5F on PRU-ICSSM with PRUICSS_writeMemory() function. For that, I am trying to use the hexpru.exe tool that is included in PRU-CGT.
I have facing an issue with the entry function _c_int00_noinit_noargs that is not included into my export using hexpru.exe. First, to explain my issue, let's start from the start. To link my firmware, I use the following sections definition (based on TI examples):
[...] /* Specify the sections allocation into memory */ SECTIONS { /* Forces _c_int00 to the start of PRU IRAM. Not necessary when loading an ELF file, but useful when loading a binary */ .text:_c_int00* > 0x0, PAGE 0 .text > PRU_IMEM, PAGE 0 .stack > PRU0_DMEM_0, PAGE 1 .bss > PRU0_DMEM_0, PAGE 1 .cio > PRU0_DMEM_0, PAGE 1 .data > PRU0_DMEM_0, PAGE 1 .switch > PRU0_DMEM_0, PAGE 1 .sysmem > PRU0_DMEM_0, PAGE 1 .cinit > PRU0_DMEM_0, PAGE 1 .rodata > PRU0_DMEM_0, PAGE 1 .rofardata > PRU0_DMEM_0, PAGE 1 .farbss > PRU0_DMEM_0, PAGE 1 .fardata > PRU0_DMEM_0, PAGE 1 }
So, the .text section starts with the entry c-function. Then, when I compile my program, I get the following section allocation map:
[...] SECTION ALLOCATION MAP output attributes/ section page origin length input sections -------- ---- ---------- ---------- ---------------- .text:_c_int00* * 0 00000000 0000001c 00000000 0000001c rtspruv1_le.lib : boot.c.obj (.text:_c_int00_noinit_noargs) .text 0 0000001c 00001568 0000001c 00000590 myObj.obj (.text:myObj_Exec) 000005ac 000001fc myobj2.obj (.text:myobj2_Cfg) [...]
So my code is correctly mapped with the entry function at address 0x0 and my own code starting at address 0x1c (as expected according to my linker script).
Then, I use hexpru.exe with following command: hexpru.exe myBuild.out -o myBuild_hex.out hexpru.cmd. hexpru.cmd is then (taken from MCU+SDK AM243x examples):
-b -map=pru_project.map SECTIONS {.text}
Unfortunately, hexpru does not detect .text:_c_int00* as part of .text section and it will not be included into my hex file...
I tried the opposite in hexpru.cmd, instead of defining which section has to be exported, I say which one must not be exported and I ended up with that export command file:
-b -map=pru_project.map --exclude=.binit --exclude=.cinit --exclude=.data --exclude=.fardata --exclude=.init_array --exclude=.ovly --exclude=.rodata --exclude=.rofardata
With this version of export command file, I can generate a hex-file that contains my whole code and then, I can export it to a header file with hex2header.exe that is included in MCU+SDK (and it works!).
Therefore, my question is how I can modify my linker script or my export script to get a working hex-file to flash from Cortex-R5F? I would prefer to list the sections I want to export than listing all sections I don't want to export (makes more sense).
Thank you for your help.
Regards, Nicolas