espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.74k stars 741 forks source link

Compile error with DEBUG=1 #2388

Closed d3nd3 closed 1 year ago

d3nd3 commented 1 year ago
source ./scripts/provision.sh  BANGLEJS
DEBUG=1 make

**targets/nrf5x/ble_ams_c/nrf_ble_ams_c.c: In function 'ble_ams_c_on_db_disc_evt': targets/nrf5x/ble_ams_c/nrf_ble_ams_c.c:52:29: error: 'ble_ams_c' undeclared (first use in this function); did you mean 'ble_ams_c_t'?

define NRF_LOG_MODULE_NAME ble_ams_c**

#include "sdk_common.h"
#if NRF_MODULE_ENABLED(BLE_AMS_C)
#include "nrf_ble_ams_c.h"
#include "ams_tx_buffer.h"
#include "ble_err.h"
#include "ble_srv_common.h"
#include "ble_db_discovery.h"
#include "app_error.h"
#ifdef DEBUG
#define NRF_LOG_MODULE_NAME ble_ams_c
#include "nrf_log.h"
NRF_LOG_MODULE_REGISTER();
#else
#define NRF_LOG_INFO(...)
#define NRF_LOG_DEBUG(...)
#endif

Also with ./scripts/create_zip_board.sh BANGLEJS , I inserted DEBUG=1 into line 143. And it fails because of some (.rodata._ZTVN6tflite20BuiltinDataAllocatorE+0xc): undefined reference to__cxa_pure_virtual'` type errors related to tensorflow

Trying:

source ./scripts/provision.sh  BANGLEJS
DEBUG=1 make

With ble_ams_c log thing removed, ~then I have to copy the zip code to get a dfu type zip somehow.~

source ./scripts/provision.sh  BANGLEJS
RELEASE=0 BOARD=BANGLEJS DFU_UPDATE_BUILD=1 make

This created the zip automatic for me. but RELEASE=0 is same as RELEASE=1 seems. My goal is to gain access to E.dumpLockedVars().

BOARD=BANGLEJS DFU_UPDATE_BUILD=1 make

Espruino/gcc-arm-none-eabi-8-2018-q4-major/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld: bin/espruino_2v18.90_banglejs.elf section `.text' will not fit in region `FLASH' Espruino/gcc-arm-none-eabi-8-2018-q4-major/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 10172 bytes

I have reason to believe some code I have is behaving abnormally/leaking and so I wanted to debug it myself with E.dumpLockedVars(), not sure if it can compile without RELEASE though.

Update: I had a mistake in my code, so the scenario for it being a leak is extremely low now.

gfwilliams commented 1 year ago

I've just sorted that particular error - it seems Nordic changed the way the module name is defined in SDK15.

However even if we fixed the _cxa_pur_virtual it doesn't really matter because of regionFLASH' overflowed by 252508 bytes` - so it's vastly bigger with debug info than would fit into flash.

Instead, you have to remove some libraries from BANGLE.py to ensure there's enough space

And yes, RELEASE=0 probably has the safe effect since I think the code is using ifdef - I just added something to make/sanitycheck.make to detect that and remove the define

Probably the best bet for getting dumpLockedVars on the Bangle is just do comment out the ifdef DEBUG bit in the JSON header for the function