https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89269
Pharos Team <rtos.pharos at outlook dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |FIXED --- Comment #6 from Pharos Team <rtos.pharos at outlook dot com> --- OK, I think I got it know. I've tried more things and indeed this seems now to be a linker problem. I tried to increase the message length (2 more bytes): void aperiodicThread0_0() { PharosHwQueueSendR sendResult; uint8_t message[] = { 0xda , 0x4f , 0xc2 , 4 , 5 , 6 , 7 , 8 , 9 , 10 }; . . . } and now the generated assembly is: 800013b8: 1101 addi sp,sp,-32 800013ba: ec06 sd ra,24(sp) 800013bc: e822 sd s0,16(sp) 800013be: 1000 addi s0,sp,32 800013c0: 00011797 auipc a5,0x11 800013c4: 1c878793 addi a5,a5,456 # 80012588 <pharosRodataStart+0x158> 800013c8: 6398 ld a4,0(a5) 800013ca: fee43023 sd a4,-32(s0) 800013ce: 0087d783 lhu a5,8(a5) 800013d2: fef41423 sh a5,-24(s0) as opposed to initially which was: 800013b8: 1101 addi sp,sp,-32 800013ba: ec06 sd ra,24(sp) 800013bc: e822 sd s0,16(sp) 800013be: 1000 addi s0,sp,32 800013c0: 00bff797 auipc a5,0xbff 800013c4: 04078793 addi a5,a5,64 # 80c00400 <partition1BssEnd> 800013c8: 639c ld a5,0(a5) 800013ca: fef43023 sd a5,-32(s0) 800013ce: 00011597 auipc a1,0x11 800013d2: 11258593 addi a1,a1,274 # 800124e0 <pharosRodataStart+0xc0> 800013d6: 4501 li a0,0 I assuming now that the linker found some 8 bytes free near the partition1BssEnd, instead of placing the data in the rodata section. By the way, the linker script for the text section is: .text : { CREATE_OBJECT_SYMBOLS /* source code is in text section */ pharosStartText = .; *(.textStart) *(.textStart.*) . = ALIGN (0x4); *(.text) *(.text.*) /* read-only data is placed in text */ . = ALIGN (0x10); pharosRodataStart = . ; *(.rodata) *(.rodata.*) *(.note.gnu.build-id) pharosRodataEnd = .; /* variable to check the end of the text section */ . = ALIGN (0x10); _endtext = .; pharosEndText = .; } > sdram and near the partition1BssEnd is: /* data of partition */ .partition1 : { CREATE_OBJECT_SYMBOLS /* address of the partition 1 data section start in RAM */ partition1DataStart = .; . = ALIGN(PARTITION_ALIGNMENT); . = ALIGN(8); partition1Start = .; *(.partition1) *(.partition1.*) /* address of the partition 1 data section end in RAM */ . = ALIGN(8); partition1DataEnd = .; } > sdram AT > sdram = 0xff /* bss of partition 1*/ .partition1Bss (NOLOAD) : { CREATE_OBJECT_SYMBOLS /* address of the partition 1 bss section start in RAM */ . = ALIGN(8); partition1BssStart = .; *(.partition1Bss) *(.partition1Bss.*) /* address of the shared partition 1 section end in RAM */ . = ALIGN(8); partition1BssEnd = .; /* place here the partition data that is NOT to be initialized at all */ partition1UssStart = .; *(.partition1Uss) *(.partition1Uss.*) partition1UssEnd = .; partition1End = .; } > sdram This is indeed one of those bugs that happens one in a million! So in short, from my part, you can close this bug (I noticed that last time you marked it as "fixed", maybe a mistake as you mark it correctly as "invalid" the other times). I'll continue to investigate if this is a binutils issue or if something has to be done on my side (linker script?) Thank you and have a good weekend (rest of it). Pharos team