Merge branch 'feature/dont_use_icache_rodata_attr' into 'master'

feat(esp8266): Don't use ICACHE_RODATA_ATTR to let string to be in flash

See merge request sdk/ESP8266_RTOS_SDK!181
This commit is contained in:
Wu Jian Gang
2018-05-24 11:27:09 +08:00
24 changed files with 19 additions and 105 deletions

View File

@ -113,48 +113,42 @@ bool ICACHE_FLASH_ATTR check_memleak_debug_enable(void)
#ifndef os_free
#define os_free(s) \
do{\
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
vPortFree_trace(s, mem_debug_file, __LINE__);\
vPortFree_trace(s, __FILE__, __LINE__);\
}while(0)
#endif
#ifndef os_malloc
#define os_malloc(s) \
({ \
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
pvPortMalloc_trace(s, mem_debug_file, __LINE__, false); \
pvPortMalloc_trace(s, __FILE__, __LINE__, false); \
})
#endif
#ifndef os_malloc_iram
#define os_malloc_iram(s) \
({ \
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
pvPortMalloc_trace(s, mem_debug_file, __LINE__, true); \
pvPortMalloc_trace(s, __FILE__, __LINE__, true); \
})
#endif
#ifndef os_calloc
#define os_calloc(p, s) \
({ \
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
pvPortCalloc_trace(p, s, mem_debug_file, __LINE__); \
pvPortCalloc_trace(p, s, __FILE__, __LINE__); \
})
#endif
#ifndef os_realloc
#define os_realloc(p, s) \
({ \
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
pvPortRealloc_trace(p, s, mem_debug_file, __LINE__); \
pvPortRealloc_trace(p, s, __FILE__, __LINE__); \
})
#endif
#ifndef os_zalloc
#define os_zalloc(s) \
({ \
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
pvPortZalloc_trace(s, mem_debug_file, __LINE__); \
pvPortZalloc_trace(s, __FILE__, __LINE__); \
})
#endif

View File

@ -204,11 +204,6 @@ static HeapRegion_t xHeapRegions[] =
#define vPortFree_t(pv) vPortFree(pv)
#define pvPortCalloc_t(count, size) pvPortCalloc(count, size)
#endif
/*-----------------------------------------------------------*/
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = "user_app";
#endif
/*-----------------------------------------------------------*/
bool ICACHE_FLASH_ATTR __attribute__((weak))

View File

@ -21,17 +21,12 @@
#include "lwip/mem.h"
#include "dhcpserver/dhcpserver.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
extern struct netif *esp_netif[2];
////////////////////////////////////////////////////////////////////////////////////
//static const uint8_t xid[4] = {0xad, 0xde, 0x12, 0x23};
//static u8_t old_xid[4] = {0};
static const u32_t magic_cookie ICACHE_RODATA_ATTR STORE_ATTR = 0x63538263;
static const u32_t magic_cookie = 0x63538263;
static struct udp_pcb* pcb_dhcps = NULL;
static struct ip4_addr server_address;
static struct ip4_addr client_address;//added

View File

@ -442,7 +442,7 @@ LOCAL int lwip_exit_mt_ioctrl(int s, int arg)
return 0;
}
LOCAL const ICACHE_RODATA_ATTR STORE_ATTR lwip_io_mt_fn lwip_enter_mt_table[] = {
LOCAL const lwip_io_mt_fn lwip_enter_mt_table[] = {
lwip_enter_mt_state,
lwip_enter_mt_recv,
lwip_enter_mt_ioctrl,
@ -451,7 +451,7 @@ LOCAL const ICACHE_RODATA_ATTR STORE_ATTR lwip_io_mt_fn lwip_enter_mt_table[] =
lwip_enter_mt_close
};
LOCAL const ICACHE_RODATA_ATTR STORE_ATTR lwip_io_mt_fn lwip_exit_mt_table[] = {
LOCAL const lwip_io_mt_fn lwip_exit_mt_table[] = {
lwip_exit_mt_state,
lwip_exit_mt_recv,
lwip_exit_mt_ioctrl,

View File

@ -89,11 +89,11 @@ static __inline__ uint64 be64toh(uint64 __x) {return (((uint64)be32toh(__x & (ui
#endif
#ifdef MEMLEAK_DEBUG
#define SSL_MALLOC(size) ax_malloc(size, mem_debug_file, __LINE__)
#define SSL_REALLOC(mem_ref,size) ax_realloc(mem_ref, size, mem_debug_file, __LINE__)
#define SSL_CALLOC(element, size) ax_calloc(element, size, mem_debug_file, __LINE__)
#define SSL_ZALLOC(size) ax_zalloc(size, mem_debug_file, __LINE__)
#define SSL_FREE(mem_ref) ax_free(mem_ref, mem_debug_file, __LINE__)
#define SSL_MALLOC(size) ax_malloc(size, __FILE__, __LINE__)
#define SSL_REALLOC(mem_ref,size) ax_realloc(mem_ref, size, __FILE__, __LINE__)
#define SSL_CALLOC(element, size) ax_calloc(element, size, __FILE__, __LINE__)
#define SSL_ZALLOC(size) ax_zalloc(size, __FILE__, __LINE__)
#define SSL_FREE(mem_ref) ax_free(mem_ref, __FILE__, __LINE__)
#else
#define SSL_MALLOC(size) malloc(size)
#define SSL_REALLOC(mem_ref,size) realloc(mem_ref, size)

View File

@ -35,10 +35,6 @@
//#include "crypto.h"
#include "lwip/mem.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
#define GET_UINT32(n,b,i) \
{ \
(n) = ((uint32_t) (b)[(i) ] << 24) \

View File

@ -44,10 +44,6 @@
#define SIGMA3(x) (ROR64(x, 1) ^ ROR64(x, 8) ^ SHR64(x, 7))
#define SIGMA4(x) (ROR64(x, 19) ^ ROR64(x, 61) ^ SHR64(x, 6))
#define MIN(x, y) ((x) < (y) ? x : y)
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
static const uint8_t padding[128] =
{

View File

@ -40,10 +40,6 @@
/* all commented out in skeleton mode */
#ifndef CONFIG_SSL_SKELETON_MODE
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
#define rot1(x) (((x) << 24) | ((x) >> 8))
#define rot2(x) (((x) << 16) | ((x) >> 16))
#define rot3(x) (((x) << 8) | ((x) >> 24))

View File

@ -63,10 +63,6 @@
#include "ssl/ssl_os_port.h"
#include "ssl/ssl_bigint.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
#define V1 v->comps[v->size-1] /**< v1 for division */
#define V2 v->comps[v->size-2] /**< v2 for division */
#define U(j) tmp_u->comps[tmp_u->size-j-1] /**< uj for division */

View File

@ -43,10 +43,6 @@
#include "wincrypt.h"
#endif
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
#ifndef WIN32
//static int rng_fd = -1;
#elif defined(CONFIG_WIN32_USE_CRYPTO_LIB)

View File

@ -37,10 +37,6 @@
#include "ssl/ssl_os_port.h"
#include "ssl/ssl_crypto.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
/**
* Perform HMAC-MD5
* NOTE: does not handle keys larger than the block size.

View File

@ -36,10 +36,6 @@
#include "ssl/ssl_os_port.h"
#include "ssl/ssl_crypto.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
void ICACHE_FLASH_ATTR RSA_priv_key_new(RSA_CTX **ctx,
const uint8_t *modulus, int mod_len,
const uint8_t *pub_exp, int pub_len,

View File

@ -37,10 +37,6 @@
#include "ssl/ssl_crypto.h"
#include "ssl/ssl_crypto_misc.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
struct tm
{
int tm_sec; /* Seconds. [0-60] (1 leap second) */

View File

@ -36,10 +36,6 @@
#include "ssl/ssl_os_port.h"
#include "ssl/ssl_ssl.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
/**
* Generate a basic X.509 certificate
*/

View File

@ -41,10 +41,6 @@
#include "ssl/ssl_os_port.h"
#include "ssl/ssl_ssl.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
static int do_obj(SSL_CTX *ssl_ctx, int obj_type,
SSLObjLoader *ssl_obj, const char *password);
#ifdef CONFIG_SSL_HAS_PEM

View File

@ -45,10 +45,6 @@
#include "ssl/ssl_os_port.h"
#include "ssl/ssl_ssl.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
#define OPENSSL_CTX_ATTR ((OPENSSL_CTX *)ssl_ctx->bonus_attr)
static char *key_password = NULL;

View File

@ -37,10 +37,6 @@
#include "ssl/ssl_os_port.h"
#include "lwip/sockets.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
#ifdef WIN32
/**
* gettimeofday() not in Win32

View File

@ -65,10 +65,6 @@
/* all commented out if not used */
#ifdef CONFIG_SSL_USE_PKCS12
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
#define BLOCK_SIZE 64
#define PKCS12_KEY_ID 1
#define PKCS12_IV_ID 2

View File

@ -38,10 +38,6 @@
#include "ssl/ssl_platform.h"
#include "lwip/err.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
/******************************************************************************
* FunctionName : esp_EVP_DigestInit
* Description : sent data for client or server

View File

@ -37,10 +37,6 @@
#include "lwip/sockets.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
/* The session expiry time */
#define SSL_EXPIRY_TIME (CONFIG_SSL_EXPIRY_TIME*3600)

View File

@ -33,10 +33,6 @@
static const uint8_t g_hello_done[] = { HS_SERVER_HELLO_DONE, 0, 0, 0 };
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
static int process_client_hello(SSL *ssl);
static int send_server_hello_sequence(SSL *ssl);
static int send_server_hello(SSL *ssl);

View File

@ -40,10 +40,6 @@
#include "lwip/sockets.h"
#ifdef MEMLEAK_DEBUG
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
#endif
#ifdef CONFIG_SSL_CERT_VERIFICATION
/**
* Retrieve the signature from a certificate.

View File

@ -32,7 +32,7 @@
set_bufflen, \
get_verify_result, \
get_state) \
static const SSL_METHOD_FUNC func_name LOCAL_ATRR = { \
static const SSL_METHOD_FUNC func_name = { \
new, \
free, \
handshake, \
@ -50,7 +50,7 @@
#define IMPLEMENT_TLS_METHOD(ver, mode, fun, func_name) \
const SSL_METHOD* func_name(void) { \
static const SSL_METHOD func_name##_data LOCAL_ATRR = { \
static const SSL_METHOD func_name##_data = { \
ver, \
mode, \
&(fun), \
@ -60,7 +60,7 @@
#define IMPLEMENT_SSL_METHOD(ver, mode, fun, func_name) \
const SSL_METHOD* func_name(void) { \
static const SSL_METHOD func_name##_data LOCAL_ATRR = { \
static const SSL_METHOD func_name##_data = { \
ver, \
mode, \
&(fun), \
@ -74,7 +74,7 @@
load, \
show_info) \
const X509_METHOD* func_name(void) { \
static const X509_METHOD func_name##_data LOCAL_ATRR = { \
static const X509_METHOD func_name##_data = { \
new, \
free, \
load, \
@ -88,7 +88,7 @@
free, \
load) \
const PKEY_METHOD* func_name(void) { \
static const PKEY_METHOD func_name##_data LOCAL_ATRR = { \
static const PKEY_METHOD func_name##_data = { \
new, \
free, \
load \

View File

@ -65,7 +65,5 @@ extern void vPortFree(void *pv);
#define SSL_DEBUG_LOG printf
#define LOCAL_ATRR ICACHE_RODATA_ATTR STORE_ATTR
#endif