Build error with PRODUCTION_DEBUG_OUTPUT enabled

ID: LPCBARESDK-734

Status: Fixed

First reported: 6.0.14.1114

Fixed in: 6.0.20.1338

Description

Compilation errors occur when the following defines are used, on any of the BLE example in the SDK and for all the targets devices.

#define CFG_PRODUCTION_DEBUG_OUTPUT
#undef CFG_DEVELOPMENT_DEBUG

Errors are formatted as follows (DA14531 case):

../../../../../sdk/platform/arch/main/hardfault_handler.c(74): error: use of undeclared identifier 'RUNNING_AT_XTAL16M'
../../../../../sdk/platform/arch/main/hardfault_handler.c(76): error: use of undeclared identifier 'XTAL16_SETTLED'
../../../../../sdk/platform/arch/main/hardfault_handler.c(84): error: use of undeclared identifier 'UART_BAUDRATE_115K2'

Workaround

In the DA14531 case the RUNNING_AT_XTAL16M and XTAL16_SETTLED should be changed to RUNNING_AT_XTAL32M and XTAL32M_SETTLED

--- a/DA145xx_SDK/6.0.18.1182.1/sdk/platform/arch/main/hardfault_handler.c
+++ b/DA145xx_SDK/6.0.18.1182.1/sdk/platform/arch/main/hardfault_handler.c
@@ -71,9 +71,9 @@ void dbg_prod_output(int mode, unsigned long *hardfault_args)
     int i;

     // Switch to XTAL16 clock, if necessary
-    if (GetBits16(CLK_CTRL_REG, RUNNING_AT_XTAL16M) == 0)
+    if (GetBits16(CLK_CTRL_REG, RUNNING_AT_XTAL32M) == 0)
     {
-        while ( !GetBits16(SYS_STAT_REG, XTAL16_SETTLED) ); // this takes some mili seconds
+        while ( !GetBits16(SYS_STAT_REG, XTAL32M_SETTLED) ); // this takes some mili seconds

         SetBits16(CLK_CTRL_REG, SYS_CLK_SEL, 0);    // select XTAL 16MHz
     }

Additionally, in the:

uart_init(UART_BAUDRATE_115K2, UART_FRAC_BAUDRATE_115K2, UART_CHARFORMAT_8);

UART_BAUDRATE_115K2, UART_FRAC_BAUDRATE_115K2 and UART_CHARFORMAT_8 macros don’t exist in the current SDK, so you can replace them with proper macros. You can refer to

Your_SDK_PATH\projects\target_apps\prod_test\prod_test\src\config\user_periph_setup.h.