Initial bare-metal foundation for nRF52840 PTT-FHSS

- Fully open toolchain: arm-none-eabi-gcc inside Podman/Docker container
- Platform-agnostic build via justfile (auto-detects podman vs docker)
- CMake + Ninja build system with arm-none-eabi toolchain file
- nRF52840 linker script and startup with full 64-entry vector table
- Register access via typed bitfield unions (include/regs.h)
- FHSS channel sequencer: AES-128-ECB PRNG over 40 channels (2402-2480 MHz)
- Low-power sleep via SYSTEM_ON WFI + GPIOTE wakeup on button press
- Vendor deps as shallow git submodules: nrfx, CMSIS_5, tiny-AES-c
This commit is contained in:
Krzysztof Cieślik
2026-05-21 20:20:21 +02:00
commit 438fca0ace
20 changed files with 739 additions and 0 deletions

66
link/nrf52840.ld Normal file
View File

@@ -0,0 +1,66 @@
/*
* nRF52840 - no SoftDevice
* Flash: 1 MB @ 0x00000000
* RAM: 256 KB @ 0x20000000
*
* Before first flash, erase the entire chip to remove any SoftDevice:
* pyocd erase --target nrf52840 --chip
*/
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
}
/* stack grows downward from the top of RAM */
_estack = ORIGIN(RAM) + LENGTH(RAM);
ENTRY(Reset_Handler)
SECTIONS
{
/* vector table must be at the start of Flash */
.isr_vector :
{
KEEP(*(.isr_vector))
. = ALIGN(4);
} > FLASH
/* code and read-only data */
.text :
{
*(.text .text.*)
*(.rodata .rodata.*)
. = ALIGN(4);
_etext = .;
} > FLASH
/* load address of .data in Flash - Reset_Handler copies from here */
_sidata = LOADADDR(.data);
/* initialized variables: stored in Flash, run from RAM */
.data :
{
_sdata = .;
*(.data .data.*)
. = ALIGN(4);
_edata = .;
} > RAM AT > FLASH
/* zero-initialized variables: Reset_Handler clears this region */
.bss (NOLOAD) :
{
_sbss = .;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
} > RAM
/DISCARD/ :
{
*(.ARM.exidx*)
*(.gnu.linkonce.armexidx.*)
}
}