Skip to content

Commit 9d9e567

Browse files
committed
esp: add linker fragment file to locate custom swift sections to proper memory regions
1 parent 52eb879 commit 9d9e567

File tree

7 files changed

+52
-9
lines changed

7 files changed

+52
-9
lines changed

esp32-led-blink-sdk/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ESP-IDF default build directory name
2+
build
3+
4+
# lock files for examples and components
5+
dependencies.lock

esp32-led-blink-sdk/dependencies.lock

Lines changed: 0 additions & 9 deletions
This file was deleted.

esp32-led-blink-sdk/main/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
idf_component_register(
22
SRCS "Dummy.c"
33
INCLUDE_DIRS "."
4+
LDFRAGMENTS "linker.lf"
45
)
56

67
execute_process(COMMAND xcrun -f swiftc OUTPUT_VARIABLE SWIFTC OUTPUT_STRIP_TRAILING_WHITESPACE)

esp32-led-blink-sdk/main/linker.lf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[sections:flash_text_swift]
2+
entries:
3+
.swift_modhash+
4+
5+
[sections:dram0_swift]
6+
entries:
7+
.got+
8+
.got.plt+
9+
10+
[scheme:swift_default]
11+
entries:
12+
flash_text_swift -> flash_text
13+
dram0_swift -> dram0_data
14+
15+
[mapping:swift_default]
16+
archive: *
17+
entries:
18+
* (swift_default);
19+
flash_text_swift -> flash_text SURROUND (swift_text),
20+
dram0_swift -> dram0_data SURROUND (swift_dram0)

esp32-led-strip-sdk/main/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ESP-IDF default build directory name
2+
build
3+
4+
# lock files for examples and components
5+
dependencies.lock

esp32-led-strip-sdk/main/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
idf_component_register(
22
SRCS "Dummy.c"
33
INCLUDE_DIRS "."
4+
LDFRAGMENTS "linker.lf"
45
)
56

67
execute_process(COMMAND xcrun -f swiftc OUTPUT_VARIABLE SWIFTC OUTPUT_STRIP_TRAILING_WHITESPACE)

esp32-led-strip-sdk/main/linker.lf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[sections:flash_text_swift]
2+
entries:
3+
.swift_modhash+
4+
5+
[sections:dram0_swift]
6+
entries:
7+
.got+
8+
.got.plt+
9+
10+
[scheme:swift_default]
11+
entries:
12+
flash_text_swift -> flash_text
13+
dram0_swift -> dram0_data
14+
15+
[mapping:swift_default]
16+
archive: *
17+
entries:
18+
* (swift_default);
19+
flash_text_swift -> flash_text SURROUND (swift_text),
20+
dram0_swift -> dram0_data SURROUND (swift_dram0)

0 commit comments

Comments
 (0)