This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Debug stack corruption problem?

I've got an issue where calling a function is overwriting a variable in the calling function. See attached screenshots. In the first, byte is 0x1b. After stepping into the function (without any more code being executed) byte is overwritten with 0x0. I don't know where to start to debug this issue! Fortunately it is easily reproducible (in my firmware), and happens every time. Any suggestions? I'm using GNU Arm Embedded Toolchain 10-2020-q4-major, debugging here with arm-none-eabi-gdb in CLion. Stepping over instructions I can see the corruption occurs during the bl instruction:

0x0004f492 <+6>:	ldrb.w	r0, [r0, #512]	; 0x200
=> 0x0004f496 <+10>:	bl	0x28b64 <min_tx_byte> // stepi triggers corruption

However, this doesn't occur every time this function is called, only during a few specific calls. The calling function is in a linked library, and the called function is in my main application, not sure if that makes any difference but explains the large delta in the bl instruction. I've checked the softdevice ram allocation (it requested 0x3120 bytes, so RAM size is 0xcee0, and I've defined __HEAP_SIZE=0 __STACK_SIZE=0x2000).

Parents
  • Hi,

    Have you monitored the value of "byte" continuously while single-stepping?

    Have you looked at the assembly code generated for the function?

    Is there any use of pointers inside of min_tx_byte?

    Regards,
    Terje

  • Hi Terje, Yes to the first two, from the question:

    => 0x0004f496 <+10>:	bl	0x28b64 <min_tx_byte> // stepi triggers corruption

    So stepping over the bl instruction causes byte to go from 0xb1 to 0x00.

    This occurs before any code in min_tx_byte runs, however the code for that function is:

    static uint8_t tx_buffer[255];
    static size_t tx_buffer_length;
    
    void min_tx_byte(uint8_t port, uint8_t byte) {
        ASSERT(tx_buffer_length < sizeof(tx_buffer));
        tx_buffer[tx_buffer_length] = byte;
        tx_buffer_length++;
    }

  • Hi,

    Right. And as it is in a linked library, you do not get to single step within that function itself?

    Is there anything fishy going on with regards to optimizations on the caller side of things? E.g. that the caller code is inlined, or the "byte" value can be deterministically decided build time (ending up as a constant in the code itself), or some other optimization leading to the value shown in debug to be wrong? Does it happen when optimization is turned off?

    Regards,
    Terje

  • The library is compiled from source so yes I can single step inside it, but it goes to 0x0 before the first line is hit.

    Here is the disassembly of the calling function:

    Dump of assembler code for function stuffed_tx_byte:
       0x0004f484 <+0>:	push	{r3, r4, r5, lr}
       0x0004f486 <+2>:	mov	r4, r0
       0x0004f488 <+4>:	mov	r5, r1
    => 0x0004f48a <+6>:	ldrb.w	r0, [r0, #512]	; 0x200
       0x0004f48e <+10>:	bl	0x28b64 <min_tx_byte>
       0x0004f492 <+14>:	mov	r1, r5
       0x0004f494 <+16>:	add.w	r0, r4, #500	; 0x1f4
       0x0004f498 <+20>:	bl	0x4f2f4 <crc32_step>

    This is with -O0, but usually I use -Og for debug builds, however the behaviour is exactly the same.

    I'm wondering if the softdevice could be overwriting it. I noticed that the softdevice observes the stack, perhaps it could be doing something that is overwriting the local variables when the function is called...

Reply
  • The library is compiled from source so yes I can single step inside it, but it goes to 0x0 before the first line is hit.

    Here is the disassembly of the calling function:

    Dump of assembler code for function stuffed_tx_byte:
       0x0004f484 <+0>:	push	{r3, r4, r5, lr}
       0x0004f486 <+2>:	mov	r4, r0
       0x0004f488 <+4>:	mov	r5, r1
    => 0x0004f48a <+6>:	ldrb.w	r0, [r0, #512]	; 0x200
       0x0004f48e <+10>:	bl	0x28b64 <min_tx_byte>
       0x0004f492 <+14>:	mov	r1, r5
       0x0004f494 <+16>:	add.w	r0, r4, #500	; 0x1f4
       0x0004f498 <+20>:	bl	0x4f2f4 <crc32_step>

    This is with -O0, but usually I use -Og for debug builds, however the behaviour is exactly the same.

    I'm wondering if the softdevice could be overwriting it. I noticed that the softdevice observes the stack, perhaps it could be doing something that is overwriting the local variables when the function is called...

Children
  • Hi,

    At least the assembler code that you provided looks sane. The "byte" value received through register r1 is moved to r5, which I must assume min_tx_byte preserves, and that should also be where the debugger takes the value from for displaying it. Have you also confirmed that program execution actually continues with a byte value of 0? I.e. that this is not just a debugger glitch?

    Regarding SoftDevice, I would expect a lot of breakage if it did any changes like this one, either on the stack or in the registers. In any case, are you expecting SoftDevice activity interrupting this function? Do you have any interrupt routines (triggered from SoftDevice or otherwise) that can interfere in any way?

    I do not see how use of the self pointer anywhere else could interfere with the value of byte, but maybe there is a link there. Is the self pointer used anywhere else? I see further down in stuffed_tx_byte() you decrement the self pointer. A bit far fetched, but if byte (residing in r5) is pushed to the stack inside min_tx_byte (i.e. min_tx_byte uses r5 for some other purpose) and while stored there an interrupt routine changes the value at that address, then yes. Could be stack/heap overlap, but as you are not using a heap it does not sound likely...

    Regards,
    Terje

  • Dump of min_tx_byte for  completeness:

    Dump of assembler code for function min_tx_byte:
    => 0x00028b64 <+0>:	push	{r4, lr}
       0x00028b66 <+2>:	mov	r4, r1
       0x00028b68 <+4>:	ldr	r3, [pc, #28]	; (0x28b88 <min_tx_byte+36>)
       0x00028b6a <+6>:	ldr	r3, [r3, #0]
       0x00028b6c <+8>:	cmp	r3, #254	; 0xfe
       0x00028b6e <+10>:	bhi.n	0x28b7e <min_tx_byte+26>
       0x00028b70 <+12>:	ldr	r2, [pc, #20]	; (0x28b88 <min_tx_byte+36>)
       0x00028b72 <+14>:	ldr	r3, [r2, #0]
       0x00028b74 <+16>:	ldr	r1, [pc, #20]	; (0x28b8c <min_tx_byte+40>)
       0x00028b76 <+18>:	strb	r4, [r1, r3]
       0x00028b78 <+20>:	adds	r3, #1
       0x00028b7a <+22>:	str	r3, [r2, #0]
       0x00028b7c <+24>:	pop	{r4, pc}
       0x00028b7e <+26>:	ldr	r1, [pc, #16]	; (0x28b90 <min_tx_byte+44>)
       0x00028b80 <+28>:	movs	r0, #129	; 0x81
       0x00028b82 <+30>:	bl	0x264e4 <assert_nrf_callback>
       0x00028b86 <+34>:	b.n	0x28b70 <min_tx_byte+12>
       0x00028b88 <+36>:	strh	r0, [r4, r7]
       0x00028b8a <+38>:	movs	r0, #0
       0x00028b8c <+40>:	strh	r0, [r4, r3]
       0x00028b8e <+42>:	movs	r0, #0
       0x00028b90 <+44>:	ldr	r2, [pc, #624]	; (0x28e04 <_generic_hvx+32>)
       0x00028b92 <+46>:	movs	r5, r0

    Yes execution does continue with a value of 0, which is how I got to this point – some of the values sent on the wire are different to the values used to compute the crc (next line after min_tx_byte is called).

    Bluetooth is not active, so the softdevice should not really be doing anything much, but the fact this happens at to the exact same bytes every time (and repeatedly, because this sequence of bytes is sent repeatedly on timer) indicates it is probably not related to interrupt activity, and anyway I think the debugger would follow the interrupt if it occurred while stepping(?). The only interrupts are through app_timer (RTC) and libuarte. I'm not using heap at all.

    The calling function is open source: github.com/.../min.c It used to work, so something changed around it (a lot has changed around it, but not the calling or called functions)

  • Hi,

    Thanks. From what I understand, the called function should be responsible for keeping registers r4 and higher. That's why at the beginning of both stuffed_tx_byte and min_tx_byte, various registers are pushed onto the stack. However, it looks like the two functions are not using the same convention. It looks like stuffed_tx_byte expects r5 not to get changed by called functions, while min_tx_byte in fact does change r5 in the final instruction (movs r5, r0), without having previously pushed that register to the stack, or otherwise keeping its value for the return. It may almost look like it rather uses r5 for a return value? That looks a bit strange. So this looks like a compiler / toolchain issue. Are both files compiled using the same toolchain, and which one?

    Regards,
    Terje

  • % /usr/local/bin/arm-none-eabi-gcc -v
    Using built-in specs.
    COLLECT_GCC=/usr/local/bin/arm-none-eabi-gcc
    COLLECT_LTO_WRAPPER=/usr/local/Cellar/arm-none-eabi-gcc/10-2020-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/10.2.1/lto-wrapper
    Target: arm-none-eabi
    Configured with: /tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/src/gcc/configure --target=arm-none-eabi --prefix=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/install-native --libexecdir=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/install-native/lib --infodir=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/install-native/arm-none-eabi --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 --with-gmp=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/build-native/host-libs/usr --with-mpfr=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/build-native/host-libs/usr --with-mpc=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/build-native/host-libs/usr --with-isl=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/build-native/host-libs/usr --with-libelf=/tmp/jenkins-GCC-10-pipeline-48_20201124_1606180639/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-lstdc++ -lm' --with-pkgversion='GNU Arm Embedded Toolchain 10-2020-q4-major' --with-multilib-list=rmprofile,aprofile
    Thread model: single
    Supported LTO compression algorithms: zlib
    gcc version 10.2.1 20201103 (release) (GNU Arm Embedded Toolchain 10-2020-q4-major) 

    To make min.c.obj:

    C_DEFINES = -DTARGET_KFSHARED_COMPONENTS
    
    C_INCLUDES = -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/lib/min
    
    C_FLAGS = --std=gnu99 -Wall -Wno-attributes -Wno-format -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -Og -g3 -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DDEBUG=1 -DMAX_NUM_CONNECTIONS=1 -DTARGET_KFSHARED_COMPONENTS -DCONFIG_GPIO_AS_PINRESET -DENABLE_LESC=0 -Wno-unknown-pragmas -std=gnu11
    
    /usr/local/bin/ccache /usr/local/bin/arm-none-eabi-gcc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/min.dir/target/min.c.obj -c /Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/lib/min/target/min.c

    To make KFPAL_Nordic_serial.c.obj:

    C_DEFINES = -DBOARD_PCA10040 -DCONFIG_GPIO_AS_PINRESET -DDEBUG=1 -DKFASSERTHANDLER_ENABLE=1 -DKF_CRYPTO_LIB_UECC -DKF_FIRMWARE=1 -DKF_FIRMWARE_VERSION=1.0.0-a.1 -DKF_MODEL=DevKit -DKF_MODEL_DevKit -DKF_SDK_VERSION=1,s132_7.2.0 -DKF_SERVER_MESSAGE -DKF_USER_MESSAGE -DMAX_NUM_CONNECTIONS=1 -DMAX_PAYLOAD=244 -DMBEDTLS_CONFIG_FILE=\"/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/external/nrf_tls/mbedtls/nrf_crypto/config/nrf_crypto_mbedtls_config.h\" -DMIN_DEBUG_PRINTING=1 -DNRF52832 -DNRF52832_XXAA -DNRF52_SERIES -DNRF_SD_BLE_API_VERSION=7 -DS132 -DSOFTDEVICE_PRESENT -DUSE_APP_CONFIG -D__HEAP_SIZE=0 -D__STACK_SIZE=0x2000 -DuECC_SUPPORTS_secp160r1=0 -DuECC_SUPPORTS_secp192r1=0 -DuECC_SUPPORTS_secp224r1=0 -DuECC_SUPPORTS_secp256k1=0
    
    C_INCLUDES = -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/src -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/src/BLEServices -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/src/HardwareCustomisations -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/balloc -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/memobj -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/strerror -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/atomic -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/ringbuf -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/external/fprintf -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log/include -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/util -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/atomic_flags -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/common -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/softdevice/common -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/nrf_ble_qwr -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/mutex -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/pwr_mgmt -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/mem_manager -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/atomic_fifo -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/fds -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/fstorage -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/experimental_section_vars -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/include -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/external/segger_rtt -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/hardfault -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/prs -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/libuarte -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/queue -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/scheduler -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/hal -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/cc310 -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/cc310_bl -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/cifra -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/mbedtls -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/micro_ecc -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/nrf_hw -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/nrf_sw -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/oberon -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/optiga -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/stack_info -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/integration/nrfx/legacy -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/timer -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_advertising -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_link_ctx_manager -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/nrf_ble_gatt -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_services/ble_dis -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_services/ble_dfu -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/svc -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/bootloader -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/bootloader/dfu -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/bootloader/ble_dfu -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/softdevice/s132/headers -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/softdevice/s132/headers/nrf52 -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/mdk -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/toolchain/cmsis/include -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/toolchain/gcc -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/toolchain/cmsis/dsp/GCC -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/boards -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/integration/nrfx -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log/src -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/delay -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/external/mbedtls/include -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/src -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/src/DeviceCustomisations -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/src/Algorithms -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/src/../UmbrellaHeaders -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/Foundation -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/BLE -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/DeviceDefaults -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/DeviceTypes -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/Cryptography -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/Messages -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/Messages/User -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/Messages/Server -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/OBDConfig -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/Logs -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/Configuration -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/SharedMessages -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/OBDProtocol/MessageHandler -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/OBDProtocol/Messages -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/src/../UmbrellaHeaders/Firmware -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/lib/micro-ecc -I/Users/nick/Documents/Repos/KeyFreeOBDFirmware/lib/KeyFreeFirmwareCommon/lib/KeyFreeSharedComponents/lib/min
    
    C_FLAGS = --std=gnu99 -Wall -Wno-attributes -Wno-format -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -Og -g3 -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DDEBUG=1 -DMAX_NUM_CONNECTIONS=1 -DTARGET_KFSHARED_COMPONENTS -DCONFIG_GPIO_AS_PINRESET -DENABLE_LESC=0 -Wno-unknown-pragmas
    
    /usr/local/bin/ccache /usr/local/bin/arm-none-eabi-gcc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_serial.c.obj -c /Users/nick/Documents/Repos/KeyFreeOBDFirmware/src/KFPAL_Nordic_serial.c

    Main link.txt:

    /usr/local/bin/ccache /usr/local/bin/arm-none-eabi-gcc --std=gnu99 -Wall -Wno-attributes -Wno-format -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -Og -g3 -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -L"/Users/nick/Documents/Repos/KeyFreeOBDFirmware/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/mdk" "-L/Users/nick/Documents/Repos/KeyFreeOBDFirmware/src/linker" -Xlinker -Map="/Users/nick/Documents/Repos/KeyFreeOBDFirmware/cmake-build-debug-arm-none-eabi/src/KeyFreeOBDFirmwareProject_DevKit.map" -T"/Users/nick/Documents/Repos/KeyFreeOBDFirmware/src/linker/nrf52832_xxAA_s132_7.2.0.ld" -u _printf_float CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/lib/KeyFreeFirmwareCommon/src/DeviceCustomisations/KFDeviceCustomisationDevKit.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/HardwareCustomisations/KFHardwareCustomisationDevKit.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/main.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_app_scheduler.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_bluetooth.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_crypto.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_flash.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_log.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_mem.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_power.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_provisioning.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_serial.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_shared.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_timer_keep_active.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/KFPAL_Nordic_timers.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/BLEServices/ble_kf_common.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/BLEServices/ble_kf_service.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/balloc/nrf_balloc.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/memobj/nrf_memobj.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/strerror/nrf_strerror.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/atomic/nrf_atomic.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/ringbuf/nrf_ringbuf.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/external/fprintf/nrf_fprintf.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/external/fprintf/nrf_fprintf_format.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log/src/nrf_log_str_formatter.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log/src/nrf_log_frontend.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log/src/nrf_log_default_backends.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log/src/nrf_log_backend_flash.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log/src/nrf_log_backend_rtt.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log/src/nrf_log_backend_serial.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/log/src/nrf_log_backend_uart.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/util/app_error.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/util/app_error_weak.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/atomic_flags/nrf_atflags.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/util/app_util_platform.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/experimental_section_vars/nrf_section_iter.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/softdevice/common/nrf_sdh_soc.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/softdevice/common/nrf_sdh_ble.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/softdevice/common/nrf_sdh.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/common/ble_conn_state.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/common/ble_conn_params.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/common/ble_advdata.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/common/ble_srv_common.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/nrf_ble_qwr/nrf_ble_qwr.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/mem_manager/mem_manager.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/atomic_fifo/nrf_atfifo.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/fds/fds.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/fstorage/nrf_fstorage.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/fstorage/nrf_fstorage_sd.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/fstorage/nrf_fstorage_nvmc.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_timer.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/external/segger_rtt/SEGGER_RTT.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_rtc.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/hardfault/hardfault_implementation.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/prs/nrfx_prs.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_uart.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_uarte.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_gpiote.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_ppi.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/libuarte/nrf_libuarte_drv.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/queue/nrf_queue.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/libuarte/nrf_libuarte_async.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/scheduler/app_scheduler.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/hal/nrf_nvmc.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/mbedtls/mbedtls_backend_init.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/mbedtls/mbedtls_backend_aes_aead.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/nrf_crypto_aead.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/nrf_crypto_init.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/nrf_crypto_shared.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/mbedtls/mbedtls_backend_hash.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/nrf_crypto_hash.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/mbedtls/mbedtls_backend_hmac.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/nrf_crypto_hmac.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_rng_mbedtls.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_init.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/nrf_crypto_rng.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_rng.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/integration/nrfx/legacy/nrf_drv_rng.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/timer/app_timer.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_advertising/ble_advertising.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_link_ctx_manager/ble_link_ctx_manager.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/nrf_ble_gatt/nrf_ble_gatt.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_services/ble_dis/ble_dis.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_services/ble_dfu/ble_dfu.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_services/ble_dfu/ble_dfu_bonded.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/ble_services/ble_dfu/ble_dfu_unbonded.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/svc/nrf_svc_handler.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/bootloader/nrf_bootloader_info.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/bootloader/dfu/nrf_dfu_svci.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/auth_status_tracker.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/gatt_cache_manager.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/gatts_cache_manager.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/id_manager.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/nrf_ble_lesc.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/peer_data_storage.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/peer_database.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/peer_id.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/peer_manager.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/peer_manager_handler.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/pm_buffer.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/security_dispatcher.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/security_manager.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/mdk/system_nrf52.c.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/modules/nrfx/mdk/gcc_startup_nrf52.S.obj CMakeFiles/KeyFreeOBDFirmwareProject_DevKit.dir/__/toolchains/nRF5/nRF5_SDK_17.0.2_d674dde/components/libraries/util/app_error_handler_gcc.c.obj -o KeyFreeOBDFirmwareProject_DevKit.elf  mbedtls/library/libmbedcrypto.a KeyFreeFirmwareCommon/src/libKeyFreeFirmwareCommon.a KeyFreeFirmwareCommon/src/KeyFreeSharedComponents/src/libKeyFreeSharedComponentsFirmware.a KeyFreeFirmwareCommon/src/KeyFreeSharedComponents/src/liblibuECC.a KeyFreeFirmwareCommon/src/KeyFreeSharedComponents/src/min/libmin.a 
    

    libmin.a link.txt:

    /usr/local/bin/ccache /usr/local/bin/arm-none-eabi-ar qc libmin.a CMakeFiles/min.dir/target/min.c.obj
    /usr/local/bin/ccache /usr/local/bin/arm-none-eabi-ranlib libmin.a
    

    I'm using CMake to generate makefiles, and the CMake scripts from the nRF mesh SDK (with my project here).

    I'm not sure all the disassembly I pasted for min_tx_byte is relevant, you can see it uses pop and ldr and then only after that is r5 present, I think the assembly after this (+36 onwards) could be for another function? I'm not sure. generic_hvx is never called in the C code though, and as you can see in my previous message min_tx_byte only has 3 lines of code and is a void return function

  • I stepped through the instructions and printed the value of $r5 and it didn't change, so I think this might have been a debugger issue (even though I thought it wasn't at first). I realised that my definition of MAX_PAYLOAD was different in the two C files. This led to the buffer size being allocated on the stack as 244 bytes, but min.c was expecting it to be 255 bytes, and so was overwriting the following members of the struct. Apologies for wasting time!

Related