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).
This commit is contained in:
Ayke van Laethem 2021-04-14 18:02:41 +02:00 committed by Ron Evans
parent 10dcd116e8
commit 340f6985ca

@ -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)
}