From 79671aa5265da2a1533d00c4f587da56b5da1bf9 Mon Sep 17 00:00:00 2001 From: Johny Mattsson Date: Fri, 24 Jun 2016 18:17:38 +1000 Subject: [PATCH] Teach Lua LTR about ESP32 drom0 location. This fixes the rather unexpected Fatal Exception(9) crashes when executing something as trivial as "=type(4)". Also ensured the #if/#else structure will complain loudly next time we port to a new board. --- app/lua/compiler.h | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/app/lua/compiler.h b/app/lua/compiler.h index 309c49b2..c135fa5b 100644 --- a/app/lua/compiler.h +++ b/app/lua/compiler.h @@ -1,37 +1,24 @@ /** * define start/end address of ro data. - * different compiler with different implementation. */ #ifndef __COMPILER_H__ #define __COMPILER_H__ -#if defined(__CC_ARM) // armcc +#if defined(__ESP8266__) -//#warning "Please check scatter file to ensure rodata is in ER_IROM1 region." - -/* symbols reference to the scatter file */ -extern char Image$$ER_IROM1$$Base; -extern char Image$$ER_IROM1$$Limit; - -#define RODATA_START_ADDRESS (&Image$$ER_IROM1$$Base) -#define RODATA_END_ADDRESS (&Image$$ER_IROM1$$Limit) - -#elif defined(__GNUC__) // gcc - -//#warning "Please check linker script to ensure rodata is between _stext and _etext." - -/* symbols defined in linker script */ -// extern char _rodata_start; -// extern char _rodata_end; extern char _irom0_text_start; extern char _irom0_text_end; -// modify linker script to ensure rodata and rodata1 is between _rodata_start and _rodata_end. -// #define RODATA_START_ADDRESS (&_rodata_start) -// #define RODATA_END_ADDRESS (&_rodata_end) #define RODATA_START_ADDRESS (&_irom0_text_start) #define RODATA_END_ADDRESS (&_irom0_text_end) +#elif defined(__ESP32__) + +extern char _drom0_text_start; +extern char _drom0_text_end; +#define RODATA_START_ADDRESS (&_drom0_text_start) +#define RODATA_END_ADDRESS (&_drom0_text_end) + #else // other compilers /* Firstly, modify rodata's start/end address. Then, comment the line below */