Multicore slave - Statics not initialised

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

Multicore slave - Statics not initialised

3,131 Views
AndyCapon
Contributor II

Hi Guys,

I have a LPCXpresso55S69 board here.

I have a Master/Slave project set up, statics in the Slave project are not initialised.

Has anyone any ideas?

Cheers

Andy

screenshot_620.png

0 Kudos
33 Replies

1,705 Views
lpcxpresso_supp
NXP Employee
NXP Employee

I've just downloaded the attached "Align_slavedata_section_V2.zip" file and can see the updated "data_section_multicore.ldt" inside it when the ZIP is decompressed.

Regards,

MCUXpresso IDE Support

0 Kudos

1,705 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Please replace the previous version with the update attached to this post, and see if this works any better for you. This now removes the alignment of the slave sections within the master project's linker script completely => it should now rely on the alignment from the input sections being imported from the slave project.

Again, remember that you will need to force the regeneration of the linker scripts after putting the new version of the .ldt file into your project.

Regards,

MCUXpresso IDE Support

0 Kudos

1,705 Views
AndyCapon
Contributor II

Hi,

Sorry only just seen this post.

The .ldt file doesn't seem to be attached.

Many thanks

Andy

0 Kudos

1,705 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Hi AndyCapon

This is going to required some more indepth investigation, but in the short term, if you put the attached "data_section_multicore.ldt" into a subdirectory called "linkscripts" in your master project, this should workaround your problem for now. Basically this ldt file is a modified version of the file built into the IDE, and it forces the alignment of the slave data section to be 8.

Note that after adding this directory / file into your master project, you will need to force the managed linker script system to regenerate the linker scripts. The easiest way to do this is to simply delete the "Debug" or "Release" subdirectory of your master project.

More information on ldt files can be found in the MCUXpresso IDE v10.3 User Guide - chapter 17, "Memory Configuration and Link Scripts".

Regards,

MCUXpresso IDE Support

0 Kudos

1,705 Views
AndyCapon
Contributor II

Thanks for the info, I will give that let file a go.

I think there may still be a problem though as I have seen alignments of 8, 32 and 64 in the slave. I have also seen a project change from 32 to 64.

0 Kudos

1,705 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Thank you for your report - we'll look into this.

Regards,

MCUXpresso IDE Support

0 Kudos

1,705 Views
AndyCapon
Contributor II

Super, thanks very much.

0 Kudos

1,705 Views
AndyCapon
Contributor II

A bit more info, it seems there is initialisation but it is all shifted by -4 bytes:

screenshot_621.png

0 Kudos

1,705 Views
AndyCapon
Contributor II

Some more info:

For C projects this only happens when using NewLib. NewlibNano and Redlib work fine so far in testing.

For C++ projects it happens in both NewLib and NewLibNano.

The offset is not always -4 bytes, seems to be maybe dependent on code or data size.

0 Kudos

1,705 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

HI Andrew,

I tested static variable in SLAVE with newlib but didn't find problem.

Can you please check my video?

How to reproduce your issue?

Have a great day,
Jun Zhang

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

0 Kudos

1,705 Views
AndyCapon
Contributor II

Hi Jun Zhang,

Thanks very much for the reply.

Unfortunately it is not working like that here.

I have attached a zip with a master/slave project I just created which has the issue, is it possible for you to test it out there?

Many thanks

Andy

StaticIssue.zip

0 Kudos

1,705 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Andrew,

I tried download your project. but dropbox is blocked from my side. Thus I can't get your project.

I am attaching my project in this reply. Can you please test it instead?

How it words on your side?

I use MCUxpresso IDE v10.3.0

Have a great day,
Jun Zhang

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,705 Views
AndyCapon
Contributor II

Hi Jun Zhang,

Thanks for the workspace file, I imported the projects and everything works fine.

I then changed the memory map to be the same as I am using and everything still worked fine.

I have attached a video of the problem here when setting up a Master/Slave project to show you what happens.

Many thanks

Andy

p.s. IDE is 10.3.1 [Build 2233], SDK is 2.5.0

0 Kudos

1,705 Views
AndyCapon
Contributor II

And some more info:

I just did a clean install of the IDE and sdk on a windows machine to test if this was an OS X issue.

I created the Master/Slave and get exactly the same problem as shown in the video I posted above.

So the problem is there on OS X and Windows.

0 Kudos

1,705 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Andrew,

I use the same IDE and SDK versions as yours

I wonder if you didn't set up the RAM connection between two cores.

I suggest you follow this document to create new Slave and master project.

Make sure you build slave first then master.


Have a great day,
Jun Zhang

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,705 Views
AndyCapon
Contributor II

Hi Jun Zhang,

Could you please look at the video I posted above, it shows me following the exact steps to create the projects.

Many thanks

Andy

0 Kudos

1,705 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Andy,

I am not in office so I can't test your issue with a board.

I found one difference from you video, comparing with the manual. The link section is section name but not Alas. please check if this is the issue.

Besides, make sure you build the slave project before the master project. it's important.

pastedImage_336.png

In order to check if the problem is due to the OS, please use the document to create two projects. I used it too. Thus we can check if have the same result.

I use 64bit win10.

If any new findings, update me here. I will check it once I get to office.

Have a nice day

Jun Zhang

0 Kudos

1,705 Views
AndyCapon
Contributor II

I just downloaded the IDE 10.3.0 [Build 2200] 

With this version I have tested both a C and C++ project Master/Slave with newlib Semihost, with this version statics are initialised correctly.

So the incorrectly initialised statics seems to be an issue introduced with 10.3.1

0 Kudos

1,705 Views
AndyCapon
Contributor II

I spoke too soon, once you start adding code the static initialisation goes wrong again.

I added McMgr and RPMsg-Lite to the slave project in 10.3.0 and the statics are then initialised wrong.

For me this board with multi core in MCUXpresso is pretty broken!

0 Kudos

1,705 Views
AndyCapon
Contributor II

Ok here is the issue:

This example is using 0x20022000 as the slave address.

If we look at the section headers for the slave axf we get:

arm-none-eabi-readelf -S TestStaticC_M33SLAVE.axf
There are 23 section headers, starting at offset 0xee538:

Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 20022000 002000 0044f4 00 AX 0 0 4
[ 2] .data PROGBITS 20026500 006500 0009b4 00 WA 0 0 8
[ 3] .bss NOBITS 20026eb4 006eb4 000130 00 WA 0 0 4
[ 4] .ARM.exidx ARM_EXIDX 200264f4 0064f4 000008 00 AL 1 0 4
[ 5] .uninit_RESERVED PROGBITS 200264fc 006eb4 000000 00 W 0 0 4
[ 6] .noinit PROGBITS 20026fe4 006eb4 000000 00 W 0 0 4
[ 7] .heap NOBITS 20026fe4 006eb4 001000 00 WA 0 0 4
[ 8] .heap2stackfill NOBITS 20027fe4 006eb4 001000 00 WA 0 0 1
[ 9] .stack PROGBITS 20043000 006eb4 000000 00 W 0 0 4
[10] .debug_info PROGBITS 00000000 006eb4 00d06a 00 0 0 1
[11] .debug_abbrev PROGBITS 00000000 013f1e 001420 00 0 0 1
[12] .debug_aranges PROGBITS 00000000 01533e 000560 00 0 0 1
[13] .debug_ranges PROGBITS 00000000 01589e 0004d0 00 0 0 1
[14] .debug_macro PROGBITS 00000000 015d6e 001194 00 0 0 1
[15] .debug_line PROGBITS 00000000 016f02 002b6d 00 0 0 1
[16] .debug_str PROGBITS 00000000 019a6f 0ce368 01 MS 0 0 1
[17] .comment PROGBITS 00000000 0e7dd7 00007f 01 MS 0 0 1
[18] .ARM.attributes ARM_ATTRIBUTES 00000000 0e7e56 000032 00 0 0 1
[19] .debug_frame PROGBITS 00000000 0e7e88 001f34 00 0 0 4
[20] .symtab SYMTAB 00000000 0e9dbc 002d40 10 21 440 4
[21] .strtab STRTAB 00000000 0ecafc 00194c 00 0 0 1
[22] .shstrtab STRTAB 00000000 0ee448 0000ee 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
y (purecode), p (processor specific)

We can see our .Text at 0x20022000 and our .data at 0x20026500

Now if we look at the master:

arm-none-eabi-readelf -S TestStaticC_MASTER.axf
There are 33 section headers, starting at offset 0x14d6a0:

Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000000 010000 0093ec 00 AX 0 0 8
[ 2] .data PROGBITS 20000000 030000 0009ac 00 WA 0 0 8
[ 3] .data_RAM2_core_m PROGBITS 20022000 022000 0044f4 00 AX 0 0 4
[ 4] .data_RAM2_core_m ARM_EXIDX 200264f4 0264f4 000008 00 AL 3 0 4
[ 5] .data_RAM2_core_m PROGBITS 200264fc 0264fc 0009b4 00 WA 0 0 8
[ 6] .data_RAM2 PROGBITS 20026eb0 0309ac 000000 00 W 0 0 4
[ 7] .data_RAM3 PROGBITS 04000000 0309ac 000000 00 W 0 0 4
[ 8] .data_RAM4 PROGBITS 40100000 0309ac 000000 00 W 0 0 4
[ 9] .bss NOBITS 200009ac 0309ac 000150 00 WA 0 0 4
[10] .ARM.exidx ARM_EXIDX 000093ec 0193ec 000008 00 AL 1 0 4
[11] .uninit_RESERVED PROGBITS 20000000 0309ac 000000 00 W 0 0 4
[12] .noinit_RAM2 PROGBITS 20026eb0 0309ac 000000 00 W 0 0 4
[13] .noinit_RAM3 PROGBITS 04000000 0309ac 000000 00 W 0 0 4
[14] .noinit_RAM4 PROGBITS 40100000 0309ac 000000 00 W 0 0 4
[15] .noinit PROGBITS 20000afc 0309ac 000000 00 W 0 0 4
[16] .heap NOBITS 20000afc 0309ac 001000 00 WA 0 0 4
[17] .heap2stackfill NOBITS 20001afc 0309ac 001000 00 WA 0 0 1
[18] .stack PROGBITS 20021000 0309ac 000000 00 W 0 0 4
[19] .debug_info PROGBITS 00000000 0309ac 019b5f 00 0 0 1
[20] .debug_abbrev PROGBITS 00000000 04a50b 002b34 00 0 0 1
[21] .debug_aranges PROGBITS 00000000 04d03f 000a38 00 0 0 1
[22] .debug_ranges PROGBITS 00000000 04da77 0009c8 00 0 0 1
[23] .debug_macro PROGBITS 00000000 04e43f 01934e 00 0 0 1
[24] .debug_line PROGBITS 00000000 06778d 006980 00 0 0 1
[25] .debug_str PROGBITS 00000000 06e10d 0d50bc 01 MS 0 0 1
[26] .comment PROGBITS 00000000 1431c9 00007f 01 MS 0 0 1
[27] .ARM.attributes ARM_ATTRIBUTES 00000000 143248 00003a 00 0 0 1
[28] .debug_frame PROGBITS 00000000 143284 003838 00 0 0 4
[29] .debug_loc PROGBITS 00000000 146abc 000a55 00 0 0 1
[30] .symtab SYMTAB 00000000 147514 003ee0 10 31 621 4
[31] .strtab STRTAB 00000000 14b3f4 00210c 00 0 0 1
[32] .shstrtab STRTAB 00000000 14d500 0001a0 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
y (purecode), p (processor specific)
MP12:ide andrewcapon$ ./plugins/com.nxp.mcuxpresso.tools.macosx_10.3.0.201811011841/tools/bin/arm-none-eabi-readelf -S /Users/andrewcapon/Documents/MCUXpressoIDE_10.3.1/workspace/TestStaticC_M33SLAVE/Debug/TestStaticC_M33SLAVE.axf
There are 23 section headers, starting at offset 0xee538:

We can see that the .data_RAM2_core_m PROGBITS is correctly set to 0x20022000 for the slave .text.

The second .data_RAM2_core_m PROGBITS is incorrectly set to 0x200264fc instead of 0x20026500, 4 bytes out.

0 Kudos