mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 17:20:53 +01:00
[ion] N0200: improve code spliting between internal/external flash
Part II: split standby in two methods: one executed from the external flash, one executed from the internal flash. This avoids to force many functions to be linked in the internal flash.
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
#include <drivers/power.h>
|
||||
#include <drivers/board.h>
|
||||
#include <drivers/external_flash.h>
|
||||
#include <drivers/reset.h>
|
||||
|
||||
namespace Ion {
|
||||
namespace Power {
|
||||
|
||||
void __attribute__((noinline)) standby() {
|
||||
Device::Power::waitUntilOnOffKeyReleased();
|
||||
Device::Power::standbyConfiguration();
|
||||
Device::Board::shutdown();
|
||||
/* We isolate the standby code that needs to be executed from the internal
|
||||
* flash (because the external flash is then shut down). We forbid inlining to
|
||||
* avoid inlining these instructions in the external flash. */
|
||||
|
||||
void __attribute__((noinline)) internal_flash_standby() {
|
||||
Device::ExternalFlash::shutdown();
|
||||
Device::Board::shutdownClocks();
|
||||
Device::Power::enterLowPowerMode();
|
||||
Device::Reset::core();
|
||||
}
|
||||
|
||||
void standby() {
|
||||
Device::Power::waitUntilOnOffKeyReleased();
|
||||
Device::Power::standbyConfiguration();
|
||||
Device::Board::shutdownPeripherals();
|
||||
internal_flash_standby();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ SECTIONS {
|
||||
* done with -fdata-sections -ffunction-sections */
|
||||
.text.internal : {
|
||||
. = ALIGN(4);
|
||||
*(.text.start)
|
||||
*(.text.abort)
|
||||
*(.text.isr_systick)
|
||||
*(.text.__assert)
|
||||
@@ -73,8 +74,7 @@ SECTIONS {
|
||||
*(.text.strcmp)
|
||||
*(.text.memmove)
|
||||
*/
|
||||
/* 'start' dependecies */
|
||||
*(.text.start)
|
||||
/* 'start' dependencies */
|
||||
*(.text._ZN3Ion6Device5Board4initEv)
|
||||
*(.text._ZN3Ion6Device5Board7initFPUEv)
|
||||
*(.text._ZN3Ion6Device5Board7initMPUEv)
|
||||
@@ -86,10 +86,13 @@ SECTIONS {
|
||||
*(.text._ZN3Ion6Device5Cache*)
|
||||
*(.text._ZN3Ion6Timing6usleepEj)
|
||||
|
||||
/* 'abort' dependcies */
|
||||
/* 'abort' dependencies */
|
||||
*(.text._ZN3Ion6Device5Reset4coreEv)
|
||||
|
||||
/**(.text._ZN3Ion5Power7suspendEb)*/
|
||||
/* 'standby' dependencies '*/
|
||||
*(.text._ZN3Ion5Power22internal_flash_standbyEv)
|
||||
*(.text._ZN3Ion6Device5Power17enterLowPowerModeEv)
|
||||
*(.text._ZN3Ion6Device5Board14shutdownClocksEb)
|
||||
|
||||
/* Optimization */
|
||||
*/libgcc.a:(.text)
|
||||
|
||||
Reference in New Issue
Block a user