Skip to content

Commit

Permalink
[avr] missing files (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbriday committed Sep 3, 2015
1 parent bce359b commit 337de69
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
13 changes: 13 additions & 0 deletions goil/templates/code/avr/service_call.goilTemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
%

let api_func::FUNC_NAME := exists api_func::ACTUAL default ( api_func::NAME )
%
.global % !api_func::FUNC_NAME %
% !api_func::FUNC_NAME %:
ldi r30,% !api_sec::ID_PREFIX %ServiceId_% !api_func::NAME% /* load the service id in r30 */
call tpl_sc_handler
ret

.type % !api_func::FUNC_NAME %,@function
// .size % !api_func::FUNC_NAME %,$-% !api_func::FUNC_NAME %

51 changes: 51 additions & 0 deletions goil/templates/code/avr/tpl_invoque_isr_s.goilTemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
%foreach isr in ISRS2
before
%
//We have to save registers that are not saved by a function call, i.e.
//R18–R27, R30, R31, R0, R1

.equ TPL_ISR2_HANDLER, 0x40
#include <avr/io.h>\n
%
do
let isr_id := INDEX + [TASKS length]
%
.equ % !isr::NAME %_id, %!isr_id%
//ISR2 %!isr::NAME% Handler
.global %!isr::SOURCE%
%!isr::SOURCE%:
push r0
push r1
push r18
push r19
push r20
push r21
push r22
push r23
push r24
push r25
push r26
push r27
push r30
push r31
ldi r24, % !isr::NAME %_id
ldi r25, 0
ldi r30,TPL_ISR2_HANDLER
call tpl_sc_handler
pop r31
pop r30
pop r27
pop r26
pop r25
pop r24
pop r23
pop r22
pop r21
pop r20
pop r19
pop r18
pop r1
pop r0
reti
%
end foreach
13 changes: 13 additions & 0 deletions goil/templates/code/avr/tpl_invoque_s.goilTemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
%
!PROJECT %/tpl_invoque.S
%
write to PROJECT."/tpl_invoque.S":
let EXTENSION := "S"
let ASSEMBLERHEADER := true
template tpl_invoque in code
end write

write to PROJECT."/tpl_invoque_isr.S":
let EXTENSION := "S"
template tpl_invoque_isr_s in code
end write
8 changes: 8 additions & 0 deletions goil/templates/code/avr/tpl_os_specific_part.goilTemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

//avr specific part.
#include <avr/io.h>
#include <avr/interrupt.h>
extern uint8_t tpl_reentrancy_counter;
extern void tpl_switch_to_kernel_stack();
extern void tpl_switch_to_user_stack();
//end of avr specific part

0 comments on commit 337de69

Please sign in to comment.