M0APP issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

M0APP issue

555 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by charchar on Tue Mar 24 11:51:37 MST 2015
I've been tracking down an issue that has to do with static initializer data for M0 code when using the M0APP mechanism.  Essentially the initializer data isn't being set, so for example, this program on the M0 side:

int foo=0x1234;

int main(void)
{
   printf("%x\n", foo);
}

will print random numbers.  Here's why ---

The M0 makefile does this:

arm-none-eabi-objcopy --target elf32-littlearm --verbose --strip-all --redefine-sym __vectors_start__=__vectors_start___core_m0app --keep-symbol __vectors_start___core_m0app --rename-section .text=".core_m0app" --rename-section .data=".core_m0app.data" --rename-section .data_RAM2=".core_m0app.data_RAM2" --rename-section .data_RAM3=".core_m0app.data_RAM3" --rename-section .data_RAM4=".core_m0app.data_RAM4" --rename-section .data_RAM5=".core_m0app.data_RAM5"

(or similar) to rename the sections so the M4 side can include them in its linker script:

    .data_RAM4 : ALIGN(4)
    {
       FILL(0xff)
       __core_m0app_START__ = .; /* start of slave image */
         KEEP(*(.core_m0app))
       __core_m0app_END__ = .; /* end of slave image */
       ASSERT(!(__core_m0app_START__ == __core_m0app_END__), "No slave code for _core_m0app");

But the line KEEP(*(.core_m0app)) fails to pick up the renamed data sections above --- e.g. .core_m0app.data doesn't match the wildcard, but

KEEP(*(.core_m0app*)) does.  (note the extra * inserted)

This one's particularly crazy-making because when attaching the debugger to the M0, the debugger typically reloads the program and the problem goes away (and it will work fine until the next cold reset).





0 Kudos
6 Replies

443 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Jul 08 07:39:37 MST 2015
In the first place, please try the template file provided here:

http://www.lpcware.com/content/forum/code-example-run-m0-flash-lpcxpresso#comment-1146487

and see if that fixes the problems you are seeing.

If that doesn't help, please provide more details of your actual issue. Seeing the actual projects in question would help, but as a minimum please provide details of what goes wrong, the map and axf files from both the master and slave projects, the axf.o file from the slave project plus the build logs (certainly the link step and post build steps, even if you strip the compile steps).

Regards,
LPCXpresso Support

0 Kudos

443 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by charchar on Wed Jul 08 06:56:59 MST 2015
Hi guys,
I'm reinvestigating this since the new 7.8 release.  The new release causes a regression for our code.  Can you help me by shedding some light on how the M0APP mechanism has changed?

thanks!
0 Kudos

443 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by charchar on Wed Mar 25 06:03:52 MST 2015
Thanks --- lpcxpresso is a good tool, and it's clear that you guys are doing a great job supporting and improving it.  :) 
0 Kudos

443 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Mar 24 17:07:44 MST 2015
Yes, this is fixed in the next release, but, due to other consideration, not in the way you suggest.
0 Kudos

443 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by charchar on Tue Mar 24 16:53:38 MST 2015
misalignment --- this is what I thought it was at first.  But this issue is missing data sections.......

The added * character added to the M4 linker script (see above) fixes it.

thanks
0 Kudos

443 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Mar 24 12:55:42 MST 2015
Apologies for the problems you are having. We have recently fixed issue with managed linker script for multi-core projects which caused misalignment of slave data section. This fix will be available in the next release of LPCXpresso which is due for release very shortly.
0 Kudos