Skip to content

Commit c0b0f8c

Browse files
authored
Remove debug defines (DEBUG & DEBUG_NRF_USER) from the build. These debug can be useful for debugging purposes but not in production (release). (#400)
This reduces the size of the binary by about 6KB! This also removes filepath that were embedded into the binary (.bin) file.
1 parent 287399f commit c0b0f8c

2 files changed

Lines changed: 23 additions & 22 deletions

File tree

src/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,15 +746,17 @@ link_directories(
746746

747747
set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -Wall -Wno-unknown-pragmas -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wreturn-type -Werror=return-type)
748748
add_definitions(-DCONFIG_GPIO_AS_PINRESET)
749-
add_definitions(-DDEBUG)
750749
add_definitions(-DNIMBLE_CFG_CONTROLLER)
751750
add_definitions(-DOS_CPUTIME_FREQ)
752751
add_definitions(-DNRF52 -DNRF52832 -DNRF52832_XXAA -DNRF52_PAN_74 -DNRF52_PAN_64 -DNRF52_PAN_12 -DNRF52_PAN_58 -DNRF52_PAN_54 -DNRF52_PAN_31 -DNRF52_PAN_51 -DNRF52_PAN_36 -DNRF52_PAN_15 -DNRF52_PAN_20 -DNRF52_PAN_55 -DBOARD_PCA10040)
753752
add_definitions(-DFREERTOS)
754-
add_definitions(-DDEBUG_NRF_USER)
755753
add_definitions(-D__STACK_SIZE=8192)
756754
add_definitions(-D__HEAP_SIZE=8192)
757755

756+
# NOTE : Add the following defines to enable debug mode of the NRF SDK:
757+
#add_definitions(-DDEBUG)
758+
#add_definitions(-DDEBUG_NRF_USER)
759+
758760
if (NOT CMAKE_BUILD_TYPE)
759761
set(CMAKE_BUILD_TYPE "Release")
760762
endif ()

src/FreeRTOS/port_cmsis.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,25 @@ static void vPortEnableVFP( void )
294294
}
295295
/*-----------------------------------------------------------*/
296296

297+
uint32_t ulSetInterruptMaskFromISR( void )
298+
{
299+
__asm volatile (
300+
" mrs r0, PRIMASK \n"
301+
" cpsid i \n"
302+
" bx lr "
303+
::: "memory"
304+
);
305+
}
306+
307+
void vClearInterruptMaskFromISR( __attribute__( ( unused ) ) uint32_t ulMask )
308+
{
309+
__asm volatile (
310+
" msr PRIMASK, r0 \n"
311+
" bx lr "
312+
::: "memory"
313+
);
314+
}
315+
297316
#if ( configASSERT_DEFINED == 1 )
298317

299318
void vPortValidateInterruptPriority( void )
@@ -354,24 +373,4 @@ static void vPortEnableVFP( void )
354373
configASSERT( NVIC_GetPriorityGrouping() <= ulMaxPRIGROUPValue );
355374
}
356375

357-
uint32_t ulSetInterruptMaskFromISR( void )
358-
{
359-
__asm volatile (
360-
" mrs r0, PRIMASK \n"
361-
" cpsid i \n"
362-
" bx lr "
363-
::: "memory"
364-
);
365-
}
366-
/*-----------------------------------------------------------*/
367-
368-
void vClearInterruptMaskFromISR( __attribute__( ( unused ) ) uint32_t ulMask )
369-
{
370-
__asm volatile (
371-
" msr PRIMASK, r0 \n"
372-
" bx lr "
373-
::: "memory"
374-
);
375-
}
376-
377376
#endif /* configASSERT_DEFINED */

0 commit comments

Comments
 (0)