From 340f6985ca18c472424522541296bbe0ea331232 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 14 Apr 2021 18:02:41 +0200 Subject: [PATCH] Use TinyGo __app_ram_base This makes sure the SoftDevice start address is configured in only one place, and thus avoid potential issues when it is changed. It also will allow setting a different SoftDevice RAM size with a linker flag starting with LLVM 11 (when expressions are allowed in the MEMORY part of a linker script). --- adapter_nrf528xx.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/adapter_nrf528xx.go b/adapter_nrf528xx.go index cbebd14..f240650 100644 --- a/adapter_nrf528xx.go +++ b/adapter_nrf528xx.go @@ -33,6 +33,9 @@ var clockConfigXtal C.nrf_clock_lf_cfg_t = C.nrf_clock_lf_cfg_t{ accuracy: C.NRF_CLOCK_LF_ACCURACY_250_PPM, } +//go:extern __app_ram_base +var appRAMBase [0]uint32 + func (a *Adapter) enable() error { // Enable the SoftDevice. var clockConfig *C.nrf_clock_lf_cfg_t @@ -45,7 +48,7 @@ func (a *Adapter) enable() error { } // Enable the BLE stack. - appRAMBase := uint32(0x200039c0) + appRAMBase := uint32(uintptr(unsafe.Pointer(&appRAMBase))) errCode = C.sd_ble_enable(&appRAMBase) return makeError(errCode) }