started working on AtMega8515 module C1.
This commit is contained in:
163
avr/devices/c01/boot/boot.asm
Normal file
163
avr/devices/c01/boot/boot.asm
Normal file
@@ -0,0 +1,163 @@
|
||||
; ***************************************************************************
|
||||
; Source file for base system node on AtMega 8515
|
||||
;
|
||||
; This is for the maintenance system (i.e. the flash loader).
|
||||
;
|
||||
; All definitions and changes should go into this file.
|
||||
; ***************************************************************************
|
||||
|
||||
.equ clock=8000000 ; Define the clock frequency
|
||||
|
||||
.nolist
|
||||
.include "include/m8515def.inc" ; Define device ATmega8515
|
||||
.list
|
||||
|
||||
.include "../defs.asm"
|
||||
.include "defs_all.asm"
|
||||
|
||||
.include "common/utils_wait.asm"
|
||||
.include "common/utils_io.asm"
|
||||
.include "modules/com2/defs.asm"
|
||||
.include "modules/comproto/defs.asm"
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; generic
|
||||
|
||||
|
||||
.equ NET_BUFFERS_NUM = 6
|
||||
.equ NET_BUFFERS_SIZE = 32
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; firmware settings
|
||||
|
||||
.equ FIRMWARE_VERSION_MAJOR = 0
|
||||
.equ FIRMWARE_VERSION_MINOR = 0
|
||||
.equ FIRMWARE_VERSION_PATCHLEVEL = 1
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; LED
|
||||
|
||||
.equ LED_DDR = DDRE
|
||||
.equ LED_PORT = PORTE
|
||||
.equ LED_PIN = PINE
|
||||
.equ LED_PINNUM = PORTE2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code segment
|
||||
|
||||
.cseg
|
||||
.org 0x0000
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Reset and interrupt vectors
|
||||
rjmp main ; 1: Reset vector RESET
|
||||
reti ; 2: INT0 External Interrupt Request 0
|
||||
reti ; 3: INT1 External Interrupt Request 1
|
||||
reti ; 4: TIMER1_CAPT Timer/Counter1 Capture Event
|
||||
reti ; 5: TIMER1_COMPA Timer/Counter1 Compare Match A
|
||||
reti ; 6: TIMER1_COMPB Timer/Counter1 Compare Match B
|
||||
reti ; 7: TIMER1_OVF Timer/Counter1 Overflow
|
||||
reti ; 8: TIMER0_OVF Timer/Counter0 Overflow
|
||||
reti ; 9: SPI_STC Serial Transfer Complete
|
||||
reti ; 10: USART_RXC USART Rx Complete
|
||||
reti ; 11: USART_UDRE USART Data Register Empty
|
||||
reti ; 12: USART_TXC USART Tx Complete
|
||||
reti ; 13: ANA_COMP Analog Comparator
|
||||
reti ; 14: INT2 External Interrupt Request 2
|
||||
reti ; 15: TIMER0_COMP Timer/Counter0 Compare Match
|
||||
reti ; 16: EE_RDY EEPROM Ready
|
||||
reti ; 17: SPM_RDY Store Program Memory Ready
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Device Info Block
|
||||
|
||||
devInfoBlock: ; 12 bytes
|
||||
devInfoManufacturer: .db 'A', 'Q', 'U', 'A'
|
||||
devInfoId: .db DEVICEINFO_ID, 0
|
||||
devInfoVersion: .db DEVICEINFO_VERSION, DEVICEINFO_REVISION ; version, revision
|
||||
firmwareVersion: .db FIRMWARE_VARIANT_BOOT, FIRMWARE_VERSION_MAJOR
|
||||
.db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
|
||||
|
||||
firmwareStart:
|
||||
rjmp main ; will be overwritten when flashing
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; main code
|
||||
|
||||
|
||||
.org BOOTLOADER_ADDR
|
||||
|
||||
|
||||
main:
|
||||
ldi r16, 0xb0 ; orig: a0
|
||||
out OSCCAL, r16
|
||||
rjmp bootLoader ; this routine is in modules/bootloader/main.asm
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; includes
|
||||
|
||||
.include "common/utils_wait_fixed.asm"
|
||||
.include "common/utils_copy_from_flash.asm"
|
||||
.include "common/utils_copy_sdram.asm"
|
||||
|
||||
.include "modules/flash/defs.asm"
|
||||
.include "modules/flash/eeprom.asm"
|
||||
.include "modules/flash/io.asm"
|
||||
.include "modules/flash/io_attn.asm"
|
||||
.include "modules/flash/io_uart.asm"
|
||||
.include "modules/flash/io_uart_all_attn.asm"
|
||||
.include "modules/flash/flash1pmega.asm"
|
||||
.include "modules/flash/flashxp.asm"
|
||||
.include "modules/flash/flashprocess.asm"
|
||||
.include "modules/flash/wait.asm"
|
||||
.include "modules/bootloader/main.asm"
|
||||
.include "modules/network/msg/defs.asm"
|
||||
.include "modules/network/msg/crc.asm"
|
||||
|
||||
;.include "common/debug.asm"
|
||||
|
||||
|
||||
|
||||
systemSetSpeed:
|
||||
#if 0 ; disabled (can't really change clock at runtime)
|
||||
.if clock == 8000000
|
||||
ldi r16, (1<<CLKPCE)
|
||||
ldi r17, 0
|
||||
out CLKPR, r16
|
||||
out CLKPR, r17
|
||||
.endif
|
||||
|
||||
.if clock == 1000000
|
||||
ldi r16, (1<<CLKPCE)
|
||||
ldi r17, (1<<CLKPS1) | (1<<CLKPS0)
|
||||
out CLKPR, r16
|
||||
out CLKPR, r17
|
||||
.endif
|
||||
#endif
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user