Skip to content

Commit 83067f1

Browse files
authored
[bsp][nrf5x] Adapt to gcc compilation (#10478)
1 parent c4d7a8a commit 83067f1

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

bsp/nrf5x/libraries/drivers/drv_uarte.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ static int _uart_putc(struct rt_serial_device *serial, char c)
254254
{
255255
}
256256
}
257+
#if defined(SOC_NRF5340)
258+
return 1;
259+
#endif /* SOC_NRF5340*/
257260
return rtn;
258261
}
259262

@@ -299,6 +302,9 @@ int rt_hw_uart_init(void)
299302

300303
#ifdef BSP_USING_UART1
301304
m_serial_1.config = config;
305+
#if defined(SOC_NRF5340)
306+
m_serial_1.config.baud_rate = 1000000;
307+
#endif /* SOC_NRF5340*/
302308
m_serial_1.ops = &_uart_ops;
303309
m_uarte1_cb.serial = &m_serial_1;
304310
rt_hw_serial_register(&m_serial_1, "uart1", \

bsp/nrf5x/nrf5340/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,32 @@ PCA10143-nrf7002 开发板常用 **板载资源** 如下:
9393
4. 输入`scons --target=mdk5` 命令重新生成工程。
9494

9595

96+
### 启用Openocd调试
97+
98+
```
99+
100+
{
101+
"version": "0.2.0",
102+
"configurations": [
103+
{
104+
"name": "nRF5340_Debug-RT-Thread",
105+
"executable": "${workspaceRoot}/rt-thread.elf",
106+
"request": "launch",
107+
"type": "cortex-debug",
108+
"runToEntryPoint": "main",
109+
"targetId": "nRF5340_xxAA_APP",//填device名
110+
"servertype": "jlink",
111+
"device": "nRF5340_xxAA_APP",//填device名
112+
"interface": "swd",
113+
"svdFile": "${workspaceRoot}/packages/nrfx-latest/mdk/nrf5340_application.svd",
114+
"armToolchainPath": "D:/bin/env-windows/tools/gnu_gcc/arm_gcc/mingw/bin", // 这里填入GCC 工具链路径,我用的是env的gcc
115+
"serverpath": "D:/RT-ThreadStudio/repo/Extract/Debugger_Support_Packages/SEGGER/J-Link/v7.92/JLinkGDBServerCL.exe" // 这里填入GDB 路径,我用的是RT-ThreadStudio,注意你的jlink路径跟我的不一样一样,可以参考
116+
}
117+
]
118+
}
119+
120+
```
121+
96122

97123
## 支持其他开发板
98124

bsp/nrf5x/nrf5340/rtconfig.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242

4343
DEVICE = ' -mcpu='+CPU + ' -mthumb -ffunction-sections -fdata-sections'
4444
CFLAGS = DEVICE
45-
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
45+
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__START=entry -D__STARTUP_CLEAR_BSS'
4646
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
4747

4848
CPATH = ''
4949
LPATH = ''
5050

5151
if BUILD == 'debug':
52-
CFLAGS += ' -O0 -gdwarf-2'
52+
CFLAGS += ' -Og -gdwarf-2'
5353
AFLAGS += ' -gdwarf-2'
5454
else:
5555
CFLAGS += ' -O2'

0 commit comments

Comments
 (0)