..
This commit is contained in:
@@ -8,12 +8,15 @@
|
||||
; Public variables in this module
|
||||
;--------------------------------------------------------
|
||||
.globl _main
|
||||
.globl _USART_Cmd
|
||||
.globl _USART_Init
|
||||
.globl _RTC_ITConfig
|
||||
.globl _RTC_WakeUpCmd
|
||||
.globl _RTC_SetWakeUpCounter
|
||||
.globl _RTC_WakeUpClockConfig
|
||||
.globl _GPIO_ResetBits
|
||||
.globl _GPIO_SetBits
|
||||
.globl _GPIO_Init
|
||||
.globl _CLK_PeripheralClockConfig
|
||||
.globl _CLK_RTCClockConfig
|
||||
.globl _CLK_SYSCLKSourceSwitchCmd
|
||||
.globl _CLK_SYSCLKDivConfig
|
||||
.globl _CLK_GetSYSCLKSource
|
||||
@@ -126,199 +129,128 @@ __sdcc_program_startup:
|
||||
; code
|
||||
;--------------------------------------------------------
|
||||
.area CODE
|
||||
; ../src/main.c: 24: void main(void)
|
||||
; ../src/main.c: 28: void main(void)
|
||||
; -----------------------------------------
|
||||
; function main
|
||||
; -----------------------------------------
|
||||
_main:
|
||||
; ../src/main.c: 27: Led_Init;
|
||||
push #0xc0
|
||||
ld a, #0x10
|
||||
ldw x, #0x500a
|
||||
; ../src/main.c: 30: GPIO_Init(GPIOB, GPIO_Pin_2, GPIO_Mode_Out_PP_Low_Fast);
|
||||
push #0xe0
|
||||
ld a, #0x04
|
||||
ldw x, #0x5005
|
||||
call _GPIO_Init
|
||||
; ../src/main.c: 28: blink(1);
|
||||
clrw x
|
||||
incw x
|
||||
call _blink
|
||||
; ../src/main.c: 29: USART_Config();
|
||||
call _USART_Config
|
||||
; ../src/main.c: 30: println("Hello");
|
||||
ldw x, #(___str_0+0)
|
||||
call _println
|
||||
; ../src/main.c: 31: while (1);
|
||||
; ../src/main.c: 33: CLK_Config();
|
||||
call _CLK_Config
|
||||
; ../src/main.c: 34: PWR_Config();
|
||||
call _PWR_Config
|
||||
; ../src/main.c: 35: Led2_Init;
|
||||
push #0xe0
|
||||
ld a, #0x04
|
||||
ldw x, #0x5005
|
||||
call _GPIO_Init
|
||||
; ../src/main.c: 36: Mono_Init;
|
||||
push #0xd0
|
||||
ld a, #0x01
|
||||
ldw x, #0x5005
|
||||
call _GPIO_Init
|
||||
; ../src/main.c: 37: blink2();
|
||||
call _blink2
|
||||
; ../src/main.c: 41: CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);
|
||||
push #0x00
|
||||
ld a, #0x10
|
||||
call _CLK_RTCClockConfig
|
||||
; ../src/main.c: 42: CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
|
||||
push #0x01
|
||||
ld a, #0x12
|
||||
call _CLK_PeripheralClockConfig
|
||||
; ../src/main.c: 45: RTC_WakeUpCmd(DISABLE);
|
||||
clr a
|
||||
call _RTC_WakeUpCmd
|
||||
; ../src/main.c: 46: RTC_WakeUpClockConfig(RTC_WakeUpClock_RTCCLK_Div2);
|
||||
ld a, #0x03
|
||||
call _RTC_WakeUpClockConfig
|
||||
; ../src/main.c: 47: RTC_SetWakeUpCounter(250);
|
||||
ldw x, #0x00fa
|
||||
call _RTC_SetWakeUpCounter
|
||||
; ../src/main.c: 48: RTC_WakeUpCmd(ENABLE);
|
||||
ld a, #0x01
|
||||
call _RTC_WakeUpCmd
|
||||
; ../src/main.c: 50: RTC_ITConfig(RTC_IT_WUT, ENABLE);
|
||||
ld a, #0x01
|
||||
ldw x, #0x0040
|
||||
call _RTC_ITConfig
|
||||
; ../src/main.c: 52: enableInterrupts();
|
||||
rim
|
||||
; ../src/main.c: 53: while (1){
|
||||
00102$:
|
||||
; ../src/main.c: 54: blink2();
|
||||
call _blink2
|
||||
; ../src/main.c: 55: halt();
|
||||
halt
|
||||
jra 00102$
|
||||
; ../src/main.c: 32: }
|
||||
; ../src/main.c: 57: }
|
||||
ret
|
||||
; ../src/main.c: 34: static void CLK_Config(void)
|
||||
; ../src/main.c: 59: static void PWR_Config(void){
|
||||
; -----------------------------------------
|
||||
; function PWR_Config
|
||||
; -----------------------------------------
|
||||
_PWR_Config:
|
||||
; ../src/main.c: 60: PWR->CSR1 = PWR_CSR1_PVDIF;
|
||||
mov 0x50b2+0, #0x20
|
||||
; ../src/main.c: 61: PWR->CSR2 = PWR_CSR2_RESET_VALUE;
|
||||
mov 0x50b3+0, #0x00
|
||||
; ../src/main.c: 62: PWR->CSR2 |= PWR_CSR2_ULP;
|
||||
bset 0x50b3, #1
|
||||
; ../src/main.c: 63: PWR->CSR2 |= PWR_CSR2_FWU;
|
||||
bset 0x50b3, #2
|
||||
; ../src/main.c: 64: }
|
||||
ret
|
||||
; ../src/main.c: 66: static void CLK_Config(void)
|
||||
; -----------------------------------------
|
||||
; function CLK_Config
|
||||
; -----------------------------------------
|
||||
_CLK_Config:
|
||||
; ../src/main.c: 37: CLK_SYSCLKSourceSwitchCmd(ENABLE);
|
||||
; ../src/main.c: 68: CLK_SYSCLKSourceSwitchCmd(ENABLE);
|
||||
ld a, #0x01
|
||||
call _CLK_SYSCLKSourceSwitchCmd
|
||||
; ../src/main.c: 38: CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_LSE);
|
||||
ld a, #0x08
|
||||
; ../src/main.c: 69: CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_LSI);
|
||||
ld a, #0x02
|
||||
call _CLK_SYSCLKSourceConfig
|
||||
; ../src/main.c: 40: CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
|
||||
; ../src/main.c: 70: CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
|
||||
clr a
|
||||
call _CLK_SYSCLKDivConfig
|
||||
; ../src/main.c: 41: while (CLK_GetSYSCLKSource() != CLK_SYSCLKSource_LSE);
|
||||
; ../src/main.c: 71: while (CLK_GetSYSCLKSource() != CLK_SYSCLKSource_LSI);
|
||||
00101$:
|
||||
call _CLK_GetSYSCLKSource
|
||||
cp a, #0x08
|
||||
cp a, #0x02
|
||||
jrne 00101$
|
||||
ret
|
||||
jra 00101$
|
||||
; ../src/main.c: 42: }
|
||||
; ../src/main.c: 72: }
|
||||
ret
|
||||
; ../src/main.c: 44: static void blink(uint16_t repeats) {
|
||||
; ../src/main.c: 85: static void blink2() {
|
||||
; -----------------------------------------
|
||||
; function blink
|
||||
; function blink2
|
||||
; -----------------------------------------
|
||||
_blink:
|
||||
sub sp, #4
|
||||
ldw (0x01, sp), x
|
||||
; ../src/main.c: 45: for (uint16_t i = 0; i <= repeats; i++) {
|
||||
clrw x
|
||||
ldw (0x03, sp), x
|
||||
00111$:
|
||||
ldw x, (0x03, sp)
|
||||
cpw x, (0x01, sp)
|
||||
jrugt 00113$
|
||||
; ../src/main.c: 46: Led_ON;
|
||||
ld a, #0x10
|
||||
ldw x, #0x500a
|
||||
call _GPIO_SetBits
|
||||
; ../src/main.c: 47: for (uint16_t j = 0; j <= 4000; j++) {nop();}
|
||||
clrw x
|
||||
00105$:
|
||||
ldw y, x
|
||||
cpw y, #0x0fa0
|
||||
jrugt 00101$
|
||||
nop
|
||||
incw x
|
||||
jra 00105$
|
||||
00101$:
|
||||
; ../src/main.c: 48: Led_OFF;
|
||||
ld a, #0x10
|
||||
ldw x, #0x500a
|
||||
call _GPIO_ResetBits
|
||||
; ../src/main.c: 49: for (uint16_t j = 0; j <= 4000; j++) {nop();}
|
||||
clrw x
|
||||
00108$:
|
||||
ldw y, x
|
||||
cpw y, #0x0fa0
|
||||
jrugt 00112$
|
||||
nop
|
||||
incw x
|
||||
jra 00108$
|
||||
00112$:
|
||||
; ../src/main.c: 45: for (uint16_t i = 0; i <= repeats; i++) {
|
||||
ldw x, (0x03, sp)
|
||||
incw x
|
||||
ldw (0x03, sp), x
|
||||
jra 00111$
|
||||
00113$:
|
||||
; ../src/main.c: 51: }
|
||||
addw sp, #4
|
||||
ret
|
||||
; ../src/main.c: 53: static void putchar(uint8_t Data) {
|
||||
; -----------------------------------------
|
||||
; function putchar
|
||||
; -----------------------------------------
|
||||
_putchar:
|
||||
; ../src/main.c: 54: while (!(USART1->SR & USART_FLAG_TXE));
|
||||
00101$:
|
||||
ldw x, #0x5230
|
||||
push a
|
||||
ld a, (x)
|
||||
ld xh, a
|
||||
pop a
|
||||
tnzw x
|
||||
jrpl 00101$
|
||||
; ../src/main.c: 55: USART1->DR = Data;
|
||||
ld 0x5231, a
|
||||
; ../src/main.c: 56: }
|
||||
ret
|
||||
; ../src/main.c: 58: static void print(const char* s){
|
||||
; -----------------------------------------
|
||||
; function print
|
||||
; -----------------------------------------
|
||||
_print:
|
||||
; ../src/main.c: 59: while (*s) {
|
||||
00101$:
|
||||
ld a, (x)
|
||||
jrne 00121$
|
||||
ret
|
||||
00121$:
|
||||
; ../src/main.c: 60: putchar(*s++);
|
||||
incw x
|
||||
pushw x
|
||||
call _putchar
|
||||
popw x
|
||||
jra 00101$
|
||||
; ../src/main.c: 62: }
|
||||
ret
|
||||
; ../src/main.c: 64: static void println(const char* s){
|
||||
; -----------------------------------------
|
||||
; function println
|
||||
; -----------------------------------------
|
||||
_println:
|
||||
; ../src/main.c: 65: print(s);
|
||||
call _print
|
||||
; ../src/main.c: 66: putchar('\n');
|
||||
ld a, #0x0a
|
||||
; ../src/main.c: 67: }
|
||||
jp _putchar
|
||||
; ../src/main.c: 69: static void USART_Config(void)
|
||||
; -----------------------------------------
|
||||
; function USART_Config
|
||||
; -----------------------------------------
|
||||
_USART_Config:
|
||||
; ../src/main.c: 72: SYSCFG->RMPCR1 &= ~(0b11 << 4);
|
||||
ld a, 0x509e
|
||||
and a, #0xcf
|
||||
ld 0x509e, a
|
||||
; ../src/main.c: 73: SYSCFG->RMPCR1 |= (0b01 << 4);
|
||||
bset 0x509e, #4
|
||||
; ../src/main.c: 75: GPIO_Init(GPIOA, GPIO_Pin_2, GPIO_Mode_Out_PP_High_Fast);
|
||||
push #0xf0
|
||||
ld a, #0x04
|
||||
ldw x, #0x5000
|
||||
call _GPIO_Init
|
||||
; ../src/main.c: 76: GPIO_Init(GPIOA, GPIO_Pin_3, GPIO_Mode_In_FL_No_IT);
|
||||
push #0x00
|
||||
ld a, #0x08
|
||||
ldw x, #0x5000
|
||||
call _GPIO_Init
|
||||
; ../src/main.c: 78: CLK_PeripheralClockConfig(CLK_Peripheral_USART1, ENABLE);
|
||||
push #0x01
|
||||
ld a, #0x05
|
||||
call _CLK_PeripheralClockConfig
|
||||
; ../src/main.c: 80: USART_Init(USART1, (uint32_t)9600,
|
||||
push #0x08
|
||||
push #0x00
|
||||
push #0x00
|
||||
push #0x00
|
||||
push #0x80
|
||||
push #0x25
|
||||
clrw x
|
||||
pushw x
|
||||
ldw x, #0x5230
|
||||
call _USART_Init
|
||||
; ../src/main.c: 83: USART_Cmd(USART1, ENABLE);
|
||||
_blink2:
|
||||
; ../src/main.c: 86: Mono_ON;
|
||||
ld a, #0x01
|
||||
ldw x, #0x5230
|
||||
; ../src/main.c: 84: }
|
||||
jp _USART_Cmd
|
||||
ldw x, #0x5005
|
||||
call _GPIO_ResetBits
|
||||
; ../src/main.c: 87: Led2_ON;
|
||||
ld a, #0x04
|
||||
ldw x, #0x5005
|
||||
call _GPIO_SetBits
|
||||
; ../src/main.c: 88: Led2_OFF;
|
||||
ld a, #0x04
|
||||
ldw x, #0x5005
|
||||
call _GPIO_ResetBits
|
||||
; ../src/main.c: 89: Mono_OFF;
|
||||
ld a, #0x01
|
||||
ldw x, #0x5005
|
||||
; ../src/main.c: 90: }
|
||||
jp _GPIO_SetBits
|
||||
.area CODE
|
||||
.area CONST
|
||||
.area CONST
|
||||
___str_0:
|
||||
.ascii "Hello"
|
||||
.db 0x00
|
||||
.area CODE
|
||||
.area INITIALIZER
|
||||
.area CABS (ABS)
|
||||
|
||||
Reference in New Issue
Block a user