cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when create RTOS Kernel

Zek_De
Senior

Hello guys,

I am trying to understand RTOS Kernel and create a simple one ,for that I am using core registers and I have a problem in asm codes.I am following UDEMY course so teacher is using Cortex M4 but because of free I am using Cortex M0 probably that is the problem but registers are same why I have errors.So codes are below.MCU is STM32F030F4 and teacher's MCU is STM32F4 Discovery Board

AREA |.text|, CODE, READONLY, ALIGN=2

THUMB

EXTERN currentPt

EXPORT SysTick_Handler

EXPORT osSchedulerLaunch

SysTick_Handler ;save r0,r1,r2,r3,r12,lr,pc,psr 

CPSID I 

PUSH {R4-R11} ;save r4,r5,r6,r7,r8,r9,r10,r11 

LDR R0, =currentPt ; r0 points to currentPt 

LDR R1, [R0] ; r1= currentPt 

STR SP, [R1] 

LDR R1, [R1,#4] ; r1 =currentPt->next 

STR R1, [R0] ;currentPt =r1 

LDR SP, [R1] ;SP= currentPt->stackPt 

POP {R4-R11} 

CPSIE I 

BX LR

osSchedulerLaunch

LDR R0, =currentPt 

LDR R2, [R0] ; R2 =currentPt 

LDR SP, [R2] ;SP = currentPt->stackPt 

POP {R4-R11} 

POP {R0-R3} 

POP {R12}

ADD SP,SP,#4 

POP {LR} 

ADD SP,SP,#4 

CPSIE I 

BX LR

ALIGN

END

I have got these errors

osKernel.s(10): error: A1874E: Specified register list cannot be loaded or stored in target instruction set

osKernel.s(13): error: A1875E: Register Rt must be from R0 to R7 in this instruction

osKernel.s(16): error: A1875E: Register Rt must be from R0 to R7 in this instruction

osKernel.s(17): error: A1874E: Specified register list cannot be loaded or stored in target instruction set

osKernel.s(26): error: A1875E: Register Rt must be from R0 to R7 in this instruction

osKernel.s(27): error: A1874E: Specified register list cannot be loaded or stored in target instruction set

osKernel.s(29): error: A1875E: Register Rn must be from R0 to R7 in this instruction

osKernel.s(31): error: A1875E: Register Rn must be from R0 to R7 in this instruction

".\Objects\my_rtos.axf" - 8 Error(s), 0 Warning(s).

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III
4 REPLIES 4
KnarfB
Principal III

ARM Cortex-M0 instruction set is only a subset of ARM Cortex-M4. So some instructions are legal for M4 but not for M0. PUSH {R4-R11} is an example. So you have to understand what is given and to translate to M0. More info: http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/BABIAJHJ.html

The "The Definitive Guide to the ARM® Cortex-M0" / M3-M4 books by Joseph Yiu give a detailed introduction.

Zek_De
Senior

Okay thank you KnarfB,

but how can I fix it in right way I tried but still my knowledge is not enough.PUSH  {R0-R7}  is OK but this time probably I am applying wrong thing

KnarfB
Principal III
Zek_De
Senior

I got the point but as much as I see I need to learn assembly language sufficiently.Thanks again.