Skip to content

Commit

Permalink
Reserve esp32 ROM stacks and adjust dram2 accordingly (esp-rs#1289)
Browse files Browse the repository at this point in the history
* reserve esp32 rom stacks and adjust dram2 accordingly

* changelog
  • Loading branch information
MabezDev authored and yanshay committed Mar 16, 2024
1 parent 544f251 commit 597a964
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Reserve `esp32` ROM stacks to prevent the trashing of dram2 section (#1289)
- Fixing `esp-wifi` + `TRNG` issue on `ESP32-S2` (#1272)
- Fixed `LCD_CAM I8080` driver potentially sending garbage to display (#1283)

Expand Down
14 changes: 11 additions & 3 deletions esp-hal/ld/esp32/memory.x
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,18 @@ MEMORY
* The segment dram2_seg after the rom data space is not mentioned in the esp32 linker scripts in esp-idf, instead the space after is used as heap space.
* It seems not all rom data space is reserved, but only "core"/"important" ROM functions that may be called after booting from ROM.
*/
reserved_rom_data_pro : ORIGIN = 0X3FFE0000, len = 1088
reserved_rom_data_app : ORIGIN = 0X3FFE3F20, len = 1072
reserved_rom_data_pro : ORIGIN = 0x3ffe0000, len = 1088
reserved_rom_data_app : ORIGIN = 0x3ffe3f20, len = 1072

dram2_seg : ORIGIN = 0x3FFE4350, len = 111k /* the rest of DRAM after the rom data segments in the middle */
/*
* The following values are derived from the __stack and _stack_sentry values from ROM.
* They represent the stacks used for each core setup by ROM code. In theory both of these
* can be reclaimed once both cores are running, but for now we play it safe and reserve them both.
*/
reserved_rom_stack_pro : ORIGIN = 0x3ffe1320, len = 11264
reserved_rom_stack_app : ORIGIN = 0x3ffe5230, len = 11264

dram2_seg : ORIGIN = 0x3ffe7e30, len = 98767 /* the rest of DRAM after the rom data segments and rom stacks in the middle */

/* external flash
The 0x20 offset is a convenience for the app binary image generation.
Expand Down

0 comments on commit 597a964

Please sign in to comment.