Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

save/restore context ATmega128L

med_alpamed_alpa Member Posts: 1
Hi,

I used the source code of RTOS to save restore context but I get error when compiling.
[code]#define BACKUP_CTX(sp)
asm volatile ("push r0
"
"in r0, __SREG__
"
"cli
"
"push r0
"
"push r1
"
"clr r1
"
"push r2
"
"push r3
"
"push r4
"
"push r5
"
"push r6
"
"push r7
"
"push r8
"
"push r9
"
"push r10
"
"push r11
"
"push r12
"
"push r13
"
"push r14
"
"push r15
"
"push r16
"
"push r17
"
"push r18
"
"push r19
"
"push r20
"
"push r21
"
"push r22
"
"push r23
"
"push r24
"
"push r25
"
"push r26
"
"push r27
"
"push r28
"
"push r29
"
"push r30
"
"push r31
"
"lds r26, % 0
"
"lds r27, % 0 + 1
"
"in r0, 0x3d
"
"st x+, r0
"
"in r0, 0x3e
"
"st x+, r0
"
:: "r" (sp[0]));



#define RESTORE_CTX(sp)
asm volatile ( "lds r26, % 0
"
"lds r27, % 0 + 1
"
"ld r28, x+
"
"out __SP_L__, r28
"
"ld r29, x+
"
"out __SP_H__, r29
"
"pop r31
"
"pop r30
"
"pop r29
"
"pop r28
"
"pop r27
"
"pop r26
"
"pop r25
"
"pop r24
"
"pop r23
"
"pop r22
"
"pop r21
"
"pop r20
"
"pop r19
"
"pop r18
"
"pop r17
"
"pop r16
"
"pop r15
"
"pop r14
"
"pop r13
"
"pop r12
"
"pop r11
"
"pop r10
"
"pop r9
"
"pop r8
"
"pop r7
"
"pop r6
"
"pop r5
"
"pop r4
"
"pop r3
"
"pop r2
"
"pop r1
"
"pop r0
"
"out __SREG__, r0
"
"pop r0
"
:"=r" (sp[0]):);
[/code]
but I get error :
[code]bin/MicaZ/core/coroutines.o: In function `cr_run':
coroutines.c:(.text+0x72): undefined reference to `r24'
coroutines.c:(.text+0x76): undefined reference to `r24'
coroutines.c:(.text+0xd4): undefined reference to `r24'
coroutines.c:(.text+0xd8): undefined reference to `r24'
coroutines.c:(.text+0xf6): undefined reference to `r24'

bin/MicaZ/core/coroutines.o:coroutines.c:(.text+0xfa): more undefined references to `r24' follow[/code]

Do you have an idea?

Sign In or Register to comment.