作業系統:Windows 11
IDE:SEGGER Embedded Studio 7.32
SDK:nRF5_SDK_17.1.0_ddde560
Board:nRF52840 (pca10056)
狀況1
.text section is larger than specified size
.rodata section is larger than specified size
解法
點擊project裡 Edit Section Placement 開啟flash_placement.xml
把下列兩行裡的 size="0x4" 刪掉
<ProgramSection alignment="4" load="Yes" name=".text"
size="0x4" />
<ProgramSection alignment="4" load="Yes" name=".rodata"
size="0x4" />
狀況2
使用uart時遇到的error
unknown type name '__printf_tag_ptr'
解法
修改..\nRF5_SDK_17.1.0_ddde560\components\libraries\uart\retarget.c
__printf_tag_ptr 改為 FILE*
Options > Code > Library > Library I/O 改為 RTT
狀況3
__vfprintf.h: No such file or directory
解法
把 SEGGER_RTT_Syscalls_SES.c 從project裡Remove
狀況4
呼叫 nrf_delay_ms()時編輯出現錯誤 ❌nrf_delay.h: No such file or directory
nrf_delay_ms() 函式的使用需增加下列SDK library路徑到
Options > Preprocessor > User Include Directories
../../../../../../components/libraries/delay
然後在main.c加入#include "nrf_delay.h"