mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-28 04:40:52 +00:00
Add feature to reserve Bluetooth RAM for ESP32 (#63)
This commit is contained in:
parent
a55c9d77ec
commit
76a2067339
@ -45,3 +45,4 @@ smart-leds = "0.3"
|
||||
default = ["rt"]
|
||||
rt = ["xtensa-lx-rt/esp32"]
|
||||
ufmt = ["esp-hal-common/ufmt"]
|
||||
bluetooth = []
|
||||
|
@ -23,9 +23,38 @@ fn main() {
|
||||
.write_all(include_bytes!("ld/linkall.x"))
|
||||
.unwrap();
|
||||
|
||||
let memory_extras = generate_memory_extras();
|
||||
File::create(out.join("memory_extras.x"))
|
||||
.unwrap()
|
||||
.write_all(&memory_extras)
|
||||
.unwrap();
|
||||
|
||||
println!("cargo:rustc-link-search={}", out.display());
|
||||
|
||||
// Only re-run the build script when memory.x is changed,
|
||||
// instead of when any part of the source code changes.
|
||||
println!("cargo:rerun-if-changed=memory.x");
|
||||
}
|
||||
|
||||
fn generate_memory_extras() -> Vec<u8> {
|
||||
let reserve_dram = if cfg!(feature = "bluetooth") {
|
||||
"0x10000"
|
||||
} else {
|
||||
"0x0"
|
||||
};
|
||||
|
||||
format!(
|
||||
"
|
||||
/* reserved at the start of DRAM for e.g. the BT stack */
|
||||
RESERVE_DRAM = {reserve_dram};
|
||||
|
||||
/* reserved at the start of the RTC memories for use by the ULP processor */
|
||||
RESERVE_RTC_FAST = 0;
|
||||
RESERVE_RTC_SLOW = 0;
|
||||
|
||||
/* define stack size for both cores */
|
||||
STACK_SIZE = 8k;"
|
||||
)
|
||||
.as_bytes()
|
||||
.to_vec()
|
||||
}
|
||||
|
@ -8,15 +8,7 @@
|
||||
/* override entry point */
|
||||
ENTRY(ESP32Reset)
|
||||
|
||||
/* reserved at the start of DRAM for e.g. teh BT stack */
|
||||
RESERVE_DRAM = 0;
|
||||
|
||||
/* reserved at the start of the RTC memories for use by the ULP processor */
|
||||
RESERVE_RTC_FAST = 0;
|
||||
RESERVE_RTC_SLOW = 0;
|
||||
|
||||
/* define stack size for both cores */
|
||||
STACK_SIZE = 8k;
|
||||
INCLUDE "memory_extras.x"
|
||||
|
||||
/* Specify main memory areas */
|
||||
MEMORY
|
||||
|
@ -9,8 +9,8 @@ pub use esp_hal_common::{
|
||||
pulse_control,
|
||||
ram,
|
||||
spi,
|
||||
utils,
|
||||
usb_serial_jtag,
|
||||
utils,
|
||||
Cpu,
|
||||
Delay,
|
||||
PulseControl,
|
||||
|
Loading…
x
Reference in New Issue
Block a user