Hello,
I was trying to run the HalGoGen 3.0 example : example_freeRTOSBlinky using a RM48 HDK.
I've followed the screens on HalCoGen help. AJusted the Include and compiler settings on my IAR and I got the following error :
"Error[Li005]: no definition for "_get_CPSR" [referenced from C:\Hercules\IAR\HCG_FREERTOS_BLINKY\Debug\Obj\os_port.o] "
I've tried to do a workaround.
I've added this code to the os_portasm.asm
-----------------------
;Get CPSR register
public vPortYield _get_CPSR
_get_CPSR
mrs r1,cpsr
bx lr
---------------------------
I also created a os_portasm.h and added the function stub:
#ifndef __OS_PORTASM__
#define __OS_PORTASM__
unsigned int _get_CPSR(void);
#endif
and included it on the os_port.c
There is any thing I'm missing ? is there some HalCoGen config that I've uset/not used that is messing up with the code.
Thanks,
Cristiano
Hi
You are correct the CCS compiler will replace the "_get_CPSR" with "mrs r1,cpsr" which IAR tool do not. I have passed this comments to the HALCoGen team and will get it fixed in the upcoming releases.
You have done what ever necessary to make the FreeRTOS port work on IAR, you should be able to use it with the change you made.
Best RegardsPrathap
~~~ If a post answers your question, please mark it with the"Verify Answer" button. ~~~
Hello Prathap,
thanks for yout attention,
Althrough doing that, the Linker didn´t finded the _get_CPSR asm function, so I´ve done a litle workaround inserting the asm code inside the .h and removing it from the .asm,
so my os_portasm.h is :
#ifndef __OS_PORTASM__#define __OS_PORTASM__unsigned int _get_CPSR(void){ asm("mrs r1,cpsr \n"); }#endif
this compiled, but its not working yet, the startup code runs, but when it calls _cmain(), it jumps ( after executing some asm ) in the 0x04 address and stays in loop.
I think it is something with the linker, but is unrelated with this topic.
Thanks for your help,
Cristiano W. Araújo
Hi Christiano
The return should always be on register "R0". I think if you change R1 to R0 it should work. My IAR licenese expired so could not give you a sample code, give me a day or two I will get back with a sample code.