mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 22:58:41 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b7fa93fcb |
@@ -0,0 +1,8 @@
|
||||
package main
|
||||
|
||||
import "machine"
|
||||
|
||||
func main() {
|
||||
println("flash data start:", machine.FlashDataStart())
|
||||
println("flash data end: ", machine.FlashDataEnd())
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//go:build nrf
|
||||
|
||||
package machine
|
||||
|
||||
import "unsafe"
|
||||
|
||||
//go:extern __flash_data_start
|
||||
var flashDataStart [0]byte
|
||||
|
||||
//go:extern __flash_data_end
|
||||
var flashDataEnd [0]byte
|
||||
|
||||
// Return the start of the writable flash area, aligned on a page boundary. This
|
||||
// is usually just after the program and static data.
|
||||
func FlashDataStart() uintptr {
|
||||
return (uintptr(unsafe.Pointer(&flashDataStart)) + flashPageSize - 1) &^ (flashPageSize - 1)
|
||||
}
|
||||
|
||||
// Return the end of the writable flash area. Usually this is the address one
|
||||
// past the end of the on-chip flash.
|
||||
func FlashDataEnd() uintptr {
|
||||
return uintptr(unsafe.Pointer(&flashDataEnd))
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"device/nrf"
|
||||
)
|
||||
|
||||
const flashPageSize = 1024
|
||||
|
||||
// Get peripheral and pin number for this GPIO pin.
|
||||
func (p Pin) getPortPin() (*nrf.GPIO_Type, uint32) {
|
||||
return nrf.GPIO, uint32(p)
|
||||
|
||||
@@ -12,6 +12,8 @@ func CPUFrequency() uint32 {
|
||||
return 64000000
|
||||
}
|
||||
|
||||
const flashPageSize = 4096
|
||||
|
||||
// InitADC initializes the registers needed for ADC.
|
||||
func InitADC() {
|
||||
return // no specific setup on nrf52 machine.
|
||||
|
||||
@@ -69,3 +69,7 @@ _heap_start = _ebss;
|
||||
_heap_end = ORIGIN(RAM) + LENGTH(RAM);
|
||||
_globals_start = _sdata;
|
||||
_globals_end = _ebss;
|
||||
|
||||
/* For the flash API */
|
||||
__flash_data_start = LOADADDR(.data) + SIZEOF(.data);
|
||||
__flash_data_end = ORIGIN(FLASH_TEXT) + LENGTH(FLASH_TEXT);
|
||||
|
||||
Reference in New Issue
Block a user