Skip to content

Commit 340f698

Browse files
aykevldeadprogram
authored andcommitted
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).
1 parent 10dcd11 commit 340f698

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

adapter_nrf528xx.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ var clockConfigXtal C.nrf_clock_lf_cfg_t = C.nrf_clock_lf_cfg_t{
3333
accuracy: C.NRF_CLOCK_LF_ACCURACY_250_PPM,
3434
}
3535

36+
//go:extern __app_ram_base
37+
var appRAMBase [0]uint32
38+
3639
func (a *Adapter) enable() error {
3740
// Enable the SoftDevice.
3841
var clockConfig *C.nrf_clock_lf_cfg_t
@@ -45,7 +48,7 @@ func (a *Adapter) enable() error {
4548
}
4649

4750
// Enable the BLE stack.
48-
appRAMBase := uint32(0x200039c0)
51+
appRAMBase := uint32(uintptr(unsafe.Pointer(&appRAMBase)))
4952
errCode = C.sd_ble_enable(&appRAMBase)
5053
return makeError(errCode)
5154
}

0 commit comments

Comments
 (0)