Custom board e73-tbb sort of works.
This commit is contained in:
parent
66a0d8e4e3
commit
868d767b56
4 changed files with 90 additions and 9 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"build": {
|
||||
"arduino":{
|
||||
"ldscript": "nrf52_xxaa.ld"
|
||||
"ldscript": "nrf52832_s132_v6.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
|
|
|
|||
40
code/parasite/ldscripts/nrf52832_s132_v6.ld
Normal file
40
code/parasite/ldscripts/nrf52832_s132_v6.ld
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* Linker script to configure memory regions. */
|
||||
/* Source: https://raw.githubusercontent.com/adafruit/Adafruit_nRF52_Arduino/master/cores/nRF5/linker/nrf52832_s132_v6.ld */
|
||||
|
||||
SEARCH_DIR(.)
|
||||
GROUP(-lgcc -lc -lnosys)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x6D000 - 0x26000
|
||||
|
||||
/* SRAM required by S132 depend on
|
||||
* - Attribute Table Size
|
||||
* - Vendor UUID count
|
||||
* - Max ATT MTU
|
||||
* - Concurrent connection peripheral + central + secure links
|
||||
* - Event Len, HVN queue, Write CMD queue
|
||||
*/
|
||||
RAM (rwx) : ORIGIN = 0x20003600, LENGTH = 0x20010000 - 0x20003600
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
.svc_data :
|
||||
{
|
||||
PROVIDE(__start_svc_data = .);
|
||||
KEEP(*(.svc_data))
|
||||
PROVIDE(__stop_svc_data = .);
|
||||
} > RAM
|
||||
|
||||
.fs_data :
|
||||
{
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
} > RAM
|
||||
} INSERT AFTER .data;
|
||||
|
||||
/* TODO(rbaron): This should be failing but it's not. Maybe it's loading it from somewhere else? */
|
||||
INCLUDE "nrf52_common.ld"
|
||||
|
|
@ -8,15 +8,11 @@
|
|||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
; [env:adafruit_feather_nrf52832]
|
||||
[env:e73-tbb]
|
||||
platform = nordicnrf52
|
||||
board = adafruit_feather_nrf52832
|
||||
; board = e73-tbb
|
||||
; board = adafruit_feather_nrf52832
|
||||
; Additionally, I had to force use_adafruit = True in platforms/nordicnrf52/builder/main.py
|
||||
board = e73-tbb
|
||||
framework = arduino
|
||||
build_flags = -DNRF52 -DS132 -DNRF51_S132
|
||||
; upload_port = /dev/cu.usbserial-14330
|
||||
; debug_tool = jlink
|
||||
; protocol = nrfutil
|
||||
; lib_deps =
|
||||
; mbed-glimwormbeacons/SEGGER_RTT2 @ 0.0.0+sha.a7800e894aaf
|
||||
board_build.ldscript = ./ldscripts/nrf52832_s132_v6.ld
|
||||
45
resources.md
45
resources.md
|
|
@ -51,3 +51,48 @@ Upgrading target on /dev/cu.usbserial-14330 with DFU package /Users/rbaron/dev/p
|
|||
Activating new firmware
|
||||
Device programmed.
|
||||
```
|
||||
|
||||
# Linking
|
||||
In [platformio-core/tools/pioplatform.py](https://github.com/platformio/platformio-core/blob/9c20ab81cb68f1ffb7a8cac22ce95c4c797643ec/platformio/builder/tools/pioplatform.py#L130):
|
||||
```Python
|
||||
if "build.ldscript" in board_config:
|
||||
env.Replace(LDSCRIPT_PATH=board_config.get("build.ldscript"))
|
||||
```
|
||||
In [platformio-core/platformio.py](https://github.com/platformio/platformio-core/blob/9c20ab81cb68f1ffb7a8cac22ce95c4c797643ec/platformio/builder/tools/platformio.py#L65):
|
||||
```Python
|
||||
# append into the beginning a main LD script
|
||||
if env.get("LDSCRIPT_PATH") and not any("-Wl,-T" in f for f in env["LINKFLAGS"]):
|
||||
env.Prepend(LINKFLAGS=["-T", env.subst("$LDSCRIPT_PATH")])
|
||||
```
|
||||
The `-T` flag expects a path to a linker script, as per [`ld` docs](https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_chapter/ld_3.html).
|
||||
|
||||
Frameworks, such as the `nordicnrf52`, contain [boards definitions](https://github.com/platformio/platform-nordicnrf52/blob/develop/boards/adafruit_feather_nrf52832.json#L4) that specify the `ldscript`.
|
||||
|
||||
1. For the [adafruit_feather_nrf52832](https://github.com/platformio/platform-nordicnrf52/blob/develop/boards/adafruit_feather_nrf52832.json#L4) board, we have:
|
||||
|
||||
```
|
||||
"arduino":{
|
||||
"ldscript": "nrf52832_s132_v6.ld"
|
||||
},
|
||||
```
|
||||
Which is defined [here](https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/linker/nrf52832_s132_v6.ld).
|
||||
|
||||
2. For the [nrf52_dk](https://github.com/platformio/platform-nordicnrf52/blob/develop/boards/nrf52_dk.json#L4), we have:
|
||||
```
|
||||
"arduino":{
|
||||
"ldscript": "nrf52_xxaa.ld"
|
||||
},
|
||||
```
|
||||
Which is the most common linker script, and is part of the nordic official SDK, it seems, available [here](https://github.com/NordicSemiconductor/nrfx/blob/master/mdk/nrf52_xxaa.ld). For reference, check out the linker for the [Adafruit nRF52 Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/linker/nrf52.ld). Here you can see the [memory map](https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/hathach-memory-map) of the nRF52 Feather.
|
||||
|
||||
## Same platform, different framework
|
||||
Both the Feather nRF52832 and the Generic boards above point to the same platform, the [nordicnrf52](). Inside this platorm, there's a switch for selecting which framework to use, based on the board name, [here](https://github.com/platformio/platform-nordicnrf52/blob/develop/platform.py#L38):
|
||||
```Python
|
||||
if self.board_config(board).get("build.bsp.name",
|
||||
"nrf5") == "adafruit":
|
||||
self.frameworks["arduino"][
|
||||
"package"] = "framework-arduinoadafruitnrf52"
|
||||
```
|
||||
|
||||
### Memory layout
|
||||
The [SoftDevice S132 spec](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s112%2FSDS%2Fs1xx%2Fmem_usage%2Fmem_resource_map_usage.html&anchor=mem_resource_map_usage) specifies the layout as the soft device begins at addr 0x0 and the application code comes after it, at the address `APP_CODE_BASE`.
|
||||
Loading…
Add table
Reference in a new issue