Here am using CMAKE with IAR compiler and integrating FreeRTOS to my project, where am seeing below error. Not able to digest and find out what is the root cause of error please help me.
Error[Lc036]: no block or place matches the pattern “ro code section CODE in portasm.s.o(libBSW.a) symbols: [vPortEnableVFP, PendSV_Handler, SVC_Handler, vPortStartFirstTask]”
From the symbols in the error message it looks like you are building one of the Cortex-M ports.
The error message is telling you portasm.s expects there to be a read only section in the linker script called CODE, but there isn’t. I don’t know what libBSW.a is. I suspect either your linker script or options passed to the assembler are incorrect, but can’t be sure.
I’m seeing a similar issue with a slightly newer version of FreeRTOS, compiling with IAR. In our situation, it seems the compilation and linking works if FreeRTOS is a top-level module in our build, but fails if it is part of another module. The difference I see in the resulting objects is as follows:
Fails to link - section is named “CODE”
portasm.o: file format elf32-little
SYMBOL TABLE:
00000000 l df *ABS* 00000000 portasm
00000001 l *ABS* 00000000 __iar_systems$$module
00000000 l CODE 00000000 __iar_section$$root
00000000 l d CODE 00000000 CODE6
00000000 l CODE 00000000 $t
000000a4 l CODE 00000000 $d.32
00000000 l d .debug_abbrev 00000000 .debug_abbrev13
00000000 l d .debug_line 00000000 .debug_line8
00000000 l d .debug_info 00000000 .debug_info12
00000000 *UND* 00000000 pxCurrentTCB
00000000 *UND* 00000000 vTaskSwitchContext
00000001 g F CODE 00000000 xPortPendSVHandler
00000059 g F CODE 00000000 vPortSVCHandler
00000075 g F CODE 00000000 vPortStartFirstTask
00000095 g F CODE 00000000 vPortEnableVFP
Whereas when compiling FreeRTOS standalone as a top-level module:
portasm.o: file format elf32-little
SYMBOL TABLE:
00000000 l df *ABS* 00000000 portasm
00000001 l *ABS* 00000000 __iar_systems$$module
00000000 l .ramcode 00000000 __iar_section$$root
00000000 l d .ramcode 00000000 .ramcode6
00000000 l .ramcode 00000000 $t
000000a8 l .ramcode 00000000 $d.32
00000000 l d .debug_abbrev 00000000 .debug_abbrev13
00000000 l d .debug_line 00000000 .debug_line8
00000000 l d .debug_info 00000000 .debug_info12
00000000 *UND* 00000000 pxCurrentTCB
00000000 *UND* 00000000 vTaskSwitchContext
00000001 g F .ramcode 00000000 PendSV_Handler
0000005d g F .ramcode 00000000 SVC_Handler
00000079 g F .ramcode 00000000 vPortStartFirstTask
00000099 g F .ramcode 00000000 vPortEnableVFP
And the linkerscript (provided by our SDK vendor) has sections named .ramcode, but not CODE
It looks like this was a combination of a mismatch / missing entry in the linker script and expedient modifications of the source to “just get it working”. In the ramcode situation, I had actually made a local change to portasm.s to change CODE to .ramcode in the local copy (and then promptly forgot I had made the change).
In the end adding the appropriate CODE entry to the linker script solved the problem for me.