introduce macros bigjmp and bigcall for intermodule calls/jmps
translates to rjmp/rcall on MCUs with up to 8K flash and to jmp/call on others.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
@@ -31,16 +32,16 @@ main:
|
||||
|
||||
; rcall watchdogOff ; turn off watchdog timer (sometimes it stays on after reboot)
|
||||
|
||||
rcall systemSetSpeed
|
||||
rcall systemInitHardware
|
||||
rcall Utils_Init
|
||||
rcall Utils_SetupUid
|
||||
rcall initModules
|
||||
rcall initApps
|
||||
rcall Utils_InitialWait
|
||||
bigcall systemSetSpeed
|
||||
bigcall systemInitHardware
|
||||
bigcall Utils_Init
|
||||
bigcall Utils_SetupUid
|
||||
bigcall initModules
|
||||
bigcall initApps
|
||||
bigcall Utils_InitialWait
|
||||
sei ; Enable interrupts
|
||||
|
||||
rcall onSystemStart
|
||||
bigcall onSystemStart
|
||||
|
||||
#ifdef MODULES_LED
|
||||
ldi xl, LOW(blinkPattern) ; debug: set blink pattern
|
||||
@@ -53,11 +54,11 @@ main:
|
||||
#endif
|
||||
|
||||
main_loop:
|
||||
rcall systemSleep ; system-dependant
|
||||
rcall runModules
|
||||
rcall runApps
|
||||
bigcall systemSleep ; system-dependant
|
||||
bigcall runModules
|
||||
bigcall runApps
|
||||
|
||||
rcall onEveryLoop ; call into main app
|
||||
bigcall onEveryLoop ; call into main app
|
||||
|
||||
#ifdef MODULES_NETWORK
|
||||
#ifndef MAIN_WITHOUT_MSG_HANDLING
|
||||
@@ -69,7 +70,7 @@ main_loop:
|
||||
|
||||
main_loop_reboot:
|
||||
cli
|
||||
rjmp BOOTLOADER_ADDR
|
||||
bigjmp BOOTLOADER_ADDR
|
||||
; @end
|
||||
|
||||
|
||||
@@ -80,53 +81,53 @@ main_loop_reboot:
|
||||
; Called every 100ms. No arguments, no results.
|
||||
|
||||
onSystemTimerTick:
|
||||
rcall onEvery100ms
|
||||
bigcall onEvery100ms
|
||||
|
||||
#ifdef MODULES_CLOCK
|
||||
rcall Clock_Every100ms ; generates calls to onEverySecond/Minute/Hour/Day
|
||||
bigcall Clock_Every100ms ; generates calls to onEverySecond/Minute/Hour/Day
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_LED_SIMPLE
|
||||
rcall LedSimple_Every100ms
|
||||
bigcall LedSimple_Every100ms
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_UART_BITBANG
|
||||
rcall UART_BitBang_Every100ms
|
||||
bigcall UART_BitBang_Every100ms
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_UART_HW
|
||||
rcall NET_Uart_Every100ms
|
||||
bigcall NET_Uart_Every100ms
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_TTYONUART1
|
||||
rcall TtyOnUart1_Periodically
|
||||
bigcall TtyOnUart1_Periodically
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_COMONUART0
|
||||
rcall ComOnUart0_Periodically
|
||||
bigcall ComOnUart0_Periodically
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_TCRT1000
|
||||
rcall TCRT1K_Every100ms
|
||||
bigcall TCRT1K_Every100ms
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef APPS_NETWORK
|
||||
ldi yl, LOW(netInterfaceData)
|
||||
ldi yh, HIGH(netInterfaceData)
|
||||
rcall AppNetwork_Every100ms
|
||||
bigcall AppNetwork_Every100ms
|
||||
#endif
|
||||
|
||||
#ifdef APPS_MOTION
|
||||
rcall AppMotion_Every100ms
|
||||
bigcall AppMotion_Every100ms
|
||||
#endif
|
||||
|
||||
#ifdef APPS_DOOR
|
||||
rcall AppDoor_Every100ms
|
||||
bigcall AppDoor_Every100ms
|
||||
#endif
|
||||
|
||||
#ifdef APPS_MA_LIGHT
|
||||
rcall AppMotionLight_Every100ms
|
||||
bigcall AppMotionLight_Every100ms
|
||||
#endif
|
||||
|
||||
ret
|
||||
@@ -138,32 +139,32 @@ onSystemTimerTick:
|
||||
|
||||
sysOnEverySecond:
|
||||
#ifdef MODULES_DS18B20
|
||||
rcall Ds18b20_OnEverySecond
|
||||
bigcall Ds18b20_OnEverySecond
|
||||
#endif
|
||||
|
||||
#ifdef APPS_REPORTSENSORS
|
||||
rcall AppReportSensors_OnEverySecond
|
||||
bigcall AppReportSensors_OnEverySecond
|
||||
#endif
|
||||
rjmp onEverySecond
|
||||
bigjmp onEverySecond
|
||||
; @end
|
||||
|
||||
|
||||
sysOnEveryMinute:
|
||||
#ifdef APPS_STATS
|
||||
rcall AppStats_OnEveryMinute
|
||||
bigcall AppStats_OnEveryMinute
|
||||
#endif
|
||||
|
||||
rjmp onEveryMinute
|
||||
bigjmp onEveryMinute
|
||||
; @end
|
||||
|
||||
|
||||
sysOnEveryHour:
|
||||
rjmp onEveryHour
|
||||
bigjmp onEveryHour
|
||||
; @end
|
||||
|
||||
|
||||
sysOnEveryDay:
|
||||
rjmp onEveryDay
|
||||
bigjmp onEveryDay
|
||||
; @end
|
||||
|
||||
#endif
|
||||
@@ -175,17 +176,17 @@ sysOnEveryDay:
|
||||
; @routine mainHandleMessages
|
||||
|
||||
mainHandleMessages:
|
||||
rcall NET_GetNextIncomingMsgNum ; R16=msg num
|
||||
bigcall NET_GetNextIncomingMsgNum ; R16=msg num
|
||||
brcc mainHandleMessages_end
|
||||
rcall NET_Buffer_Locate ; X=buffer addr (R17)
|
||||
bigcall NET_Buffer_Locate ; X=buffer addr (R17)
|
||||
adiw xh:xl, 1
|
||||
|
||||
push r16
|
||||
rcall onMessageReceived
|
||||
rcall mainModulesOnPacketReceived
|
||||
rcall mainAppsOnPacketReceived
|
||||
bigcall onMessageReceived
|
||||
bigcall mainModulesOnPacketReceived
|
||||
bigcall mainAppsOnPacketReceived
|
||||
pop r16
|
||||
rcall NET_Buffer_ReleaseByNum
|
||||
bigcall NET_Buffer_ReleaseByNum
|
||||
sec
|
||||
mainHandleMessages_end:
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user