diff --git a/embed/firmware/main.c b/embed/firmware/main.c index 6db5e9559..423f14226 100644 --- a/embed/firmware/main.c +++ b/embed/firmware/main.c @@ -21,12 +21,22 @@ #include "sdcard.h" #include "touch.h" +bool firmware_standalone(void) +{ + extern const uint32_t _flash_start; + return _flash_start == 0x0800000; +} + int main(void) { periph_init(); pendsv_init(); + if (firmware_standalone()) { + display_init(); + } + display_pwm_init(); display_orientation(0); display_backlight(255); diff --git a/embed/firmware/memory.ld b/embed/firmware/memory.ld index baa232e38..ab738c3f4 100644 --- a/embed/firmware/memory.ld +++ b/embed/firmware/memory.ld @@ -92,6 +92,9 @@ SECTIONS .ARM.attributes 0 : { *(.ARM.attributes) } } +_flash_start = ORIGIN(FLASH); +_flash_end = ORIGIN(FLASH) + LENGTH(FLASH); + /* RAM extents for the garbage collector */ _codelen = SIZEOF(.flash) + SIZEOF(.data); _ram_start = ORIGIN(RAM); diff --git a/embed/firmware/memory0.ld b/embed/firmware/memory0.ld index 1302641b1..da85e17c7 100644 --- a/embed/firmware/memory0.ld +++ b/embed/firmware/memory0.ld @@ -85,6 +85,9 @@ SECTIONS .ARM.attributes 0 : { *(.ARM.attributes) } } +_flash_start = ORIGIN(FLASH); +_flash_end = ORIGIN(FLASH) + LENGTH(FLASH); + /* RAM extents for the garbage collector */ _codelen = SIZEOF(.flash) + SIZEOF(.data); _ram_start = ORIGIN(RAM);