Reputation: 429
I'm currently trying to port code that was written for the IAR Compiler to GCC and I'm running into an error involving the uC/OS - III RTOS from Micrium.
The error:
undefined reference to `CPU_SR_Save'
This error leads me eventually to this line in cpu.h
in the uC/OS-III code that calls CPU_SR_Save:
#define CPU_INT_DIS() do { cpu_sr = CPU_SR_Save(); } while (0) /* Save CPU status word & disable interrupts.*/
and later...
CPU_SR CPU_SR_Save (void);
CPU_SR_Save is in an Assembly file cpu_a.s
in the same directory:
.thumb_func
CPU_SR_Save:
MRS R0, PRIMASK @ Set prio int mask to mask all (except faults)
CPSID I
BX LR
with this a further up in the file...
.global CPU_SR_Save
I'm pretty sure the compiler/linker has no idea this assembly file exists, and I'm struggling to figure out a way to integrate it into the rest of the build. I've looked all over the internet, but so far haven't found anything that's worked. I'm still fairly new to this stuff, so I might be thinking of things incorrectly.
Does anybody have any suggestions as to how I can get my program to see this Assembly file?
Here are all the things I have tried so far:
extern
to the line CPU_SR CPU_SR_Save (void);
.s
to .S
-x assembler-with-cpp "fullPath\cpu_a.s"
to the compiler optionsI'm using Visual Studio with VisualGDB and here is the link to the code that is giving me this error: https://github.com/lhr-solar/uCOS-III-STM32F4/tree/master/uC-CPU/ARM-Cortex-M4/GNU
Upvotes: 1
Views: 370