crt0.S File Reference

Doxygen doesn't handle assembly code well. Look at the source code instead. More...

#include <avr/io.h>
#include <avr/sfr_defs.h>

Go to the source code of this file.

Defines

#define __zero_reg__   r1

Functions

macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out 
_SFR_IO_ADDR (SREG)
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi 
lo8 (__stack) ldi r29
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi 
hi8 (__stack) out _SFR_IO_ADDR(SPH)
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out 
_SFR_IO_ADDR (SPL)
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data 
hi8 (__data_end) ldi r26
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data 
lo8 (__data_start) ldi r27
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data 
hi8 (__data_start) ldi r30
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data 
lo8 (__data_load_start) ldi r31
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data 
hi8 (__data_load_start) ldi r16
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data 
hh8 (__data_load_start) out _SFR_IO_ADDR(RAMPZ)
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data r16 rjmp L__do_copy_data_start
Z st r0 
lo8 (__data_end) cpc r27

Variables

macro vector name weak name
set 
name
macro vector name weak name
set __vector_not_set jmp name
endm section 
vectors
macro vector name weak name
set __vector_not_set jmp name
endm section 
ax
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors 
__vectors
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors 
ax
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init 
__init
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set 
__heap_end
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section 
init2
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section 
ax
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi 
r28
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section 
init4
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section 
ax
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data 
__do_copy_data
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data r16 rjmp L__do_copy_data_start 
L__do_copy_data_loop
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data r16 rjmp L__do_copy_data_start
Z st 
X
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data r16 rjmp L__do_copy_data_start
Z st r0 
L__do_copy_data_start
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data r16 rjmp L__do_copy_data_start
Z st r0 r17 brne L__do_copy_data_loop
section 
init9
macro vector name weak name
set __vector_not_set jmp name
endm section progbits global
__vectors func __vectors progbits
weak __init RAMEND weak __heap_end
set section progbits clr __zero_reg__
out __zero_reg__ ldi r29 out
r28 section progbits global
__do_copy_data r16 rjmp L__do_copy_data_start
Z st r0 r17 brne L__do_copy_data_loop
section 
ax


Detailed Description

Doxygen doesn't handle assembly code well. Look at the source code instead.

Use only one of crt0.S and crt0.c

An assembler file modified by Scott Craig from gcrt1.S

For use in Mantis Cheng's CSC 460 Fall 2007

To use this as startup code in AVR Studio, add "-nostartfiles" to [Linker Options] in Project>Configuration options>Custom Options.

The name of the function in the last call is where the program starts. (For project 2 it should be "OS_Init".)

Definition in file crt0.S.


Define Documentation

#define __zero_reg__   r1

gcc expects this register to contain 0. This loses the use of one register, but it speeds up operations such as clearing a memory location.

Definition at line 59 of file crt0.S.


Function Documentation

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out _SFR_IO_ADDR ( SREG   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi lo8 ( __stack   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi hi8 ( __stack   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out _SFR_IO_ADDR ( SPL   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data hi8 ( __data_end   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data lo8 ( __data_start   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data hi8 ( __data_start   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data lo8 ( __data_load_start   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data hi8 ( __data_load_start   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data hh8 ( __data_load_start   ) 

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data r16 rjmp L__do_copy_data_start Z st r0 lo8 ( __data_end   ) 


Variable Documentation

macro vector name weak name set name

A macro to simplify the vector list.

The symbol "__vector_i" is weakly bound to this spot in the object file. Later, other object files can reference this spot using this symbol.

The value of the symbol is set to "__vector_not_set", which is the label of a function below. Other files will change this if an ISR is declared.

The instruction at this spot is "jmp (addr)" (4 bytes). These addresses are hardwired in the mcu.

Definition at line 77 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section vectors

The vectors section.

The numbers are off by 1 from the hardware manual, but consistent with iousbxx6_7.h. Vector "0" is the reset vector, which jumps to the executable code.

Any interrupt ISR definition in the C code will overwrite these default definitions.

Definition at line 77 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section ax

Definition at line 77 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors __vectors

Definition at line 77 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors ax

Definition at line 77 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init __init

Definition at line 77 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set __heap_end

Definition at line 77 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section init2

init2

Clear the "zero" register, clear the status register, and set the stack pointer.

Definition at line 77 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section ax

Definition at line 77 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r28

Definition at line 170 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section init4

init4

Copy data from __data_load_start in program memory to __data_start in SRAM, initializing data in the process. A similar routine with the same name is defined in libgcc.S. This routine overrides it.

Definition at line 183 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section ax

Definition at line 183 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data __do_copy_data

Definition at line 183 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data r16 rjmp L__do_copy_data_start L__do_copy_data_loop

Definition at line 195 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data r16 rjmp L__do_copy_data_start Z st X

Definition at line 195 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data r16 rjmp L__do_copy_data_start Z st r0 L__do_copy_data_start

Definition at line 195 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data r16 rjmp L__do_copy_data_start Z st r0 r17 brne L__do_copy_data_loop section init9

init9

The last of the init functions. Usually this would be the jump to "main()"

Definition at line 225 of file crt0.S.

macro vector name weak name set __vector_not_set jmp name endm section progbits global __vectors func __vectors progbits weak __init RAMEND weak __heap_end set section progbits clr __zero_reg__ out __zero_reg__ ldi r29 out r28 section progbits global __do_copy_data r16 rjmp L__do_copy_data_start Z st r0 r17 brne L__do_copy_data_loop section ax

Definition at line 225 of file crt0.S.


Generated on Tue Oct 23 21:49:51 2007 for RTOS by  doxygen 1.5.1