Make atomthreads assemble with SDCC

This commit is contained in:
Philipp Klaus Krause
2016-06-16 20:59:11 +02:00
parent a013142b7e
commit 7e03729526
4 changed files with 57 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
; uint8_t get_cc(void);
_get_cc::
push cc
pop a
ret
; void set_cc(uint8_t);
_set_cc::
ld a, (3, sp)
push a
pop cc
ret
; void archContextSwitch (ATOM_TCB *old_tcb_ptr, ATOM_TCB *new_tcb_ptr)
_archContextSwitch::
; save context
ldw x, (3, sp)
ldw y, sp
ldw (x), y
; restore context
ldw x, (5, sp)
jra restore
; void archFirstThreadRestore (ATOM_TCB *new_tcb_ptr)
_archFirstThreadRestore::
; restore context
ldw x, (3, sp)
restore:
ldw x, (x)
ldw sp, x
ret

View File

@@ -95,6 +95,8 @@ static NO_REG_SAVE void thread_shell (void)
rim();
#elif defined(__RCSTM8__)
_rim_();
#elif defined(__SDCC_stm8)
__asm__("rim");
#endif
/* Call the thread entry point */
@@ -293,6 +295,7 @@ void archInitSystemTickTimer ( void )
INTERRUPT void TIM1_SystemTickISR (void)
#if defined(__RCSTM8__)
interrupt 11
#elif defined(__SDCC_stm8)
__interrupt(11)
#endif
@@ -309,3 +312,4 @@ __interrupt(11)
/* Call the interrupt exit routine */
atomIntExit(TRUE);
}

View File

@@ -42,7 +42,7 @@ vpath %.elf .\$(BUILD_DIR)
vpath %.hex .\$(BUILD_DIR)
# Compiler/Assembler flags
CFLAGS= -mstm8 -c -D $(PART) --opt-code-size --max-allocs-per-node 300
CFLAGS= -mstm8 -c -D $(PART) --opt-code-size --max-allocs-per-node 3000
DBG_CFLAGS= -mstm8 -c -D $(PART) --opt-code-size --max-allocs-per-node 3000
ASMFLAGS= -off
DBG_ASMFLAGS= -off

View File

@@ -154,3 +154,19 @@ size_t __write(int handle, const unsigned char *buf, size_t bufSize)
return (chars_written);
}
#endif /* __IAR_SYSTEMS_ICC__ */
#if defined(__SDCC_stm8)
#if __SDCC_REVISION >= 9624
int putchar (int c)
{
return(uart_putchar(c));
}
#else
void putchar (char c)
{
uart_putchar(c);
}
#endif
#endif