Add Cygwin support for app/lua/luac_cross make and spiffsimg
This commit is contained in:
parent
8dc6eb62df
commit
7956a47bb4
|
@ -1,47 +0,0 @@
|
||||||
/**
|
|
||||||
* define start/end address of ro data.
|
|
||||||
* different compiler with different implementation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __COMPILER_H__
|
|
||||||
#define __COMPILER_H__
|
|
||||||
|
|
||||||
#if defined(__CC_ARM) // armcc
|
|
||||||
|
|
||||||
//#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)
|
|
||||||
|
|
||||||
#else // other compilers
|
|
||||||
|
|
||||||
/* Firstly, modify rodata's start/end address. Then, comment the line below */
|
|
||||||
#error "Please modify RODATA_START_ADDRESS and RODATA_END_ADDRESS below."
|
|
||||||
|
|
||||||
/* Perhaps you can use start/end address of flash */
|
|
||||||
#define RODATA_START_ADDRESS ((char*)0x40200000)
|
|
||||||
#define RODATA_END_ADDRESS ((char*)0x40280000)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __COMPILER_H__
|
|
||||||
|
|
|
@ -125,17 +125,22 @@ void luaR_getcstr(char *dest, const TString *src, size_t maxsize) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LUA_META_ROTABLES
|
||||||
|
/* Set in RO check depending on platform */
|
||||||
|
#if defined(LUA_CROSS_COMPILER) && defined(__CYGWIN__)
|
||||||
|
extern char __end__[];
|
||||||
|
#define IN_RO_AREA(p) ((p) < __end__)
|
||||||
|
#elif defined(LUA_CROSS_COMPILER)
|
||||||
|
extern char _edata[];
|
||||||
|
#define IN_RO_AREA(p) ((p) < _edata)
|
||||||
|
#else /* xtensa tool chain for ESP target */
|
||||||
|
extern char _irom0_text_start[];
|
||||||
|
extern char _irom0_text_end[];
|
||||||
|
#define IN_RO_AREA(p) ((p) >= _irom0_text_start && (p) <= _irom0_text_end)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Return 1 if the given pointer is a rotable */
|
/* Return 1 if the given pointer is a rotable */
|
||||||
#ifdef LUA_META_ROTABLES
|
|
||||||
#ifdef LUA_CROSS_COMPILER
|
|
||||||
extern char edata[];
|
|
||||||
int luaR_isrotable(void *p) {
|
int luaR_isrotable(void *p) {
|
||||||
return (char*)p <= edata;
|
return IN_RO_AREA((char *)p);
|
||||||
}
|
|
||||||
#else
|
|
||||||
#include "compiler.h"
|
|
||||||
int luaR_isrotable(void *p) {
|
|
||||||
return RODATA_START_ADDRESS <= (char*)p && (char*)p <= RODATA_END_ADDRESS;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
|
@ -80,13 +80,16 @@ static TString *newlstr (lua_State *L, const char *str, size_t l,
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "compiler.h"
|
|
||||||
static int lua_is_ptr_in_ro_area(const char *p) {
|
|
||||||
#ifdef LUA_CROSS_COMPILER
|
#ifdef LUA_CROSS_COMPILER
|
||||||
return 0;
|
#define IN_RO_AREA(p) (0)
|
||||||
#else
|
#else /* xtensa tool chain for ESP */
|
||||||
return p >= RODATA_START_ADDRESS && p <= RODATA_END_ADDRESS;
|
extern char _irom0_text_start[];
|
||||||
|
extern char _irom0_text_end[];
|
||||||
|
#define IN_RO_AREA(p) ((p) >= _irom0_text_start && (p) <= _irom0_text_end)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int lua_is_ptr_in_ro_area(const char *p) {
|
||||||
|
return IN_RO_AREA(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue