Move libmain bss into external ram?

expresspotato
Posts: 33
Joined: Fri May 28, 2021 1:58 pm

Move libmain bss into external ram?

Postby expresspotato » Thu Jan 16, 2025 5:24 pm

So does anyone know how to move the bss segment of a component (in this case main) into external ram? I seem to need to use a linker fragment, but not sure what extra directives or steps are needed, because I'm unfamiliar with the linker fragment.

Code: Select all

Per-archive contributions to ELF file:
            Archive File DRAM .data & 0.bss .ext_ram.bss .rtc_noinit .rtc.text .noinit IRAM0 .text & 0.vectors ram_st_total Flash .text & .rodata & .rodata_noload & .appdesc flash_total
                 libbt.a       4774       0        51347           0         0       0        1658           0        57779      503966    139630                0          0      650028
               libmain.a       2805    5881            0           1         0    1024       18193           0        27904       95248     85160                0          0      202431

So I tried to mimic the linker fragment found in idf, for another component, but it didn't seem to work...

CMakeLists.txt (in the main folder)

Code: Select all

idf_component_register(
	SRCS 
                ...
		"main.c"
	INCLUDE_DIRS 
		"include"
		"ulp/include"
		"."
	LDFRAGMENTS "app.lf"
)

And a Linker Fragment of:

Code: Select all

[scheme:default]
entries:
    if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y:
        bss -> extern_ram
    else:
        bss -> dram0_bss

[mapping:main]
archive: libmain.a
entries:
    * (bss);
But the results remain the same...

MicroController
Posts: 1955
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Move libmain bss into external ram?

Postby MicroController » Thu Jan 16, 2025 6:20 pm

https://docs.espressif.com/projects/esp ... config-bss
Additional data can be moved from the internal BSS segment to external RAM by applying the macro EXT_RAM_BSS_ATTR to any static declaration (which is not initialized to a non-zero value).

expresspotato
Posts: 33
Joined: Fri May 28, 2021 1:58 pm

Re: Move libmain bss into external ram?

Postby expresspotato » Thu Jan 16, 2025 7:57 pm

MicroController wrote:
Thu Jan 16, 2025 6:20 pm
https://docs.espressif.com/projects/esp ... config-bss
Additional data can be moved from the internal BSS segment to external RAM by applying the macro EXT_RAM_BSS_ATTR to any static declaration (which is not initialized to a non-zero value).
Hey, thanks for your reply.

The page says "It is also possible to place the BSS section of a component or a library to external RAM using linker fragment scheme extram_bss."

Rather than go at it variable by variable, it seems like I could place the entire segment there with the correct linker fragment directive.

I don't know enough of how the linker works to come up with anything meaningful.

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 103 guests