How to disable 20737S SDK trace, BLE_TRACE_DISABLE?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

===

SDK: 2.1.1

Tag: 920737.

app: hello-sensor.

===


Problem:

In order to save RAM and NV space, if we want to disable trace (empty the trace) by define

BLE_TRACE_DISABLE in bleapp.h but in SDK 2.1.1 env, this library can not be re-gen.
Is there any answer to delete its lib.a and trigger the library build again? thx.



0 Likes
1 Solution
Anonymous
Not applicable

#include "sparcommon.h" or

define below macro in your app:

#define BLE_APP_DISABLE_TRACING()  do{                                          \

                                         extern UINT8 bleapp_trace_enable;      \

                                         extern UINT32 blecm_enabledFeatures;   \

                                         bleapp_trace_enable = 0;               \

                                         blecm_enabledFeatures &= ~(0x04);      \

                                     }while(0)

Then use this macro:

APPLICATION_INIT()

{

    bleapp_set_cfg((UINT8 *)hello_sensor_gatt_database,

                   sizeof(hello_sensor_gatt_database),

                   (void *)&hello_sensor_cfg,

                   (void *)&hello_sensor_puart_cfg,

                   (void *)&hello_sensor_gpio_cfg,

                   hello_sensor_create);

   BLE_APP_DISABLE_TRACING();

}

Hope it helps.

View solution in original post

9 Replies
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

I looked up hello_sensor.c and I saw this... Does this help?

// Application initialization

APPLICATION_INIT()

{

    bleapp_set_cfg((UINT8 *)hello_sensor_gatt_database,

                   sizeof(hello_sensor_gatt_database),

                   (void *)&hello_sensor_cfg,

                   (void *)&hello_sensor_puart_cfg,

                   (void *)&hello_sensor_gpio_cfg,

                   hello_sensor_create);

    // BLE_APP_DISABLE_TRACING();     ////// Uncomment to disable all tracing

}

0 Likes
Anonymous
Not applicable

#include "sparcommon.h" or

define below macro in your app:

#define BLE_APP_DISABLE_TRACING()  do{                                          \

                                         extern UINT8 bleapp_trace_enable;      \

                                         extern UINT32 blecm_enabledFeatures;   \

                                         bleapp_trace_enable = 0;               \

                                         blecm_enabledFeatures &= ~(0x04);      \

                                     }while(0)

Then use this macro:

APPLICATION_INIT()

{

    bleapp_set_cfg((UINT8 *)hello_sensor_gatt_database,

                   sizeof(hello_sensor_gatt_database),

                   (void *)&hello_sensor_cfg,

                   (void *)&hello_sensor_puart_cfg,

                   (void *)&hello_sensor_gpio_cfg,

                   hello_sensor_create);

   BLE_APP_DISABLE_TRACING();

}

Hope it helps.

Anonymous
Not applicable

Hi, Roger,

coz in app layer, we use many ble_tracex for our app code debug. But for HW resource issue,

I find in bleapp.h, there is a define BLE_TRACE_DISABLE to let all ble_tracex "EMPTY" instead of
body and this is what I need now. But currently, it's not defined so code trace is in there of image. It may let code and RAM size bigger. So may i know any change to build out with this header's related library when BLE_TRACE_DISABLE is defined for trace off. TKS.

Anonymous
Not applicable

Hi, Leo,

My understanding is that you can only use less ble_tracex in your own app to save some memory space.

As mwf_mmfae mentioned above, most of the traces come from the ROM code and it will not consume RAM or NVRAM space. You cannot remove them but can disable them.

Hope it helps.

0 Likes
Anonymous
Not applicable

ok, thanks.

0 Likes
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

My understanding is that all traces come out of the ROM (so these cannot be removed, only disabled at runtime) or the application (you have full control of when trace code is included and when it is not).

arvinds

0 Likes
Anonymous
Not applicable

Hi, Roger and boont,

As I know, when product is in MP phase, developer will disable all trace, sometimes, we use
trace_flag switch to turn some trivial parts off and leave some important trace.
However, what I meet is our firmware resource (RAM and NV) space may be not enough, so
I need to use BLE_TRACE_DISABLE in bleapp.h to reduce compiling stuff related to trace so that
constant string will not be located in NVRAM or if system will run code in RAM, trace code will be not included
in compiling level to save code/data space.

If following above u mention, it seems to be a switch off action to disable trace but all app. layer code trace is still compiled in image. Please correct me if i make mistakes. BTW, if I modify bleapp.h and what modification of SDK env, can system re-build its library? TKS.

0 Likes
Anonymous
Not applicable

I used this method, to remove all user-defined ble_trace() function calls in the user codebase:


Add this to the end of your make target:

GCC_FLAGS="-DBLE_TRACE_DISABLE"

This defines the BLE_TRACE_DISABLE precompiler option at compile time, which removes all user calls to ble_trace(). It does not remove any tracing in the Broadcom libraries themselves though. For that, I saw this function in "bleapp.h:"

void ble_traceDisable(void);

Haven't tried it, but it may be useful to you.

P.S. Once I disabled my own debug tracing in my app, it ran SOOOO much faster! They don't tell you that those UART writes are very expensive if you do them often. I was crashing my program because I was writing too much debug code to it.

Anonymous
Not applicable

Hi, Odbol,

Thanks for ur info, i have tried ur suggestion and workable.

0 Likes