Hi,
I did try to follow this example. https://www.silabs.com/community/mcu/32 ... scrip-s5bu
no luck.
I just need to define my structure at specified RAM location ( fix address) on Esp32.
Is it possible. how can i do it. kindly give me full example including changing Esp32 linker file.
Using a linker script in GCC to locate functions at specific memory regions
Re: Using a linker script in GCC to locate functions at specific memory regions
Hi snahmad,
The ESP-IDF is quite a complex development environment compared to very simple microcontrollers, so this can require some care and has some potential pitfalls.
Can you please explain exactly what you aim to do? (ie for what purpose do you want to place a function at a specific memory address?)
Angus
The ESP-IDF is quite a complex development environment compared to very simple microcontrollers, so this can require some care and has some potential pitfalls.
Can you please explain exactly what you aim to do? (ie for what purpose do you want to place a function at a specific memory address?)
Angus
Re: Using a linker script in GCC to locate functions at specific memory regions
Hi Angus,
We have a need for an application to open and read an ESP32 BIN file to extract various data values, including the firmware version number. To achieve this, the application needs to look in a defined (external) Flash ROM address to find this table of values.
We defined a MEMORY block (in esp32.ld) at the very beginning of external Flash ROM:
drom0_boftable_seg (R) : org = 0x3F400018, len = 0x100 /* Data table */
We defined a SECTION (in esp32.common.ld):
.drom0_boftable 0x3F400018 :
{
KEEP(*(.bof_table))
} > drom0_boftable_seg
We defined the data table in a project code module:
const BOFTablePtr_s _MainAppDT[] __attribute__((__section__(".bof_table"))) = {
/* 1st Vector */
<pointer 1>,
/* 2nd Vector */
<pointer 2>,
/* Last Vector */
(void*)NULL
};
We feel that we're close, so any help you can offer will be gratefully received.
We have a need for an application to open and read an ESP32 BIN file to extract various data values, including the firmware version number. To achieve this, the application needs to look in a defined (external) Flash ROM address to find this table of values.
We defined a MEMORY block (in esp32.ld) at the very beginning of external Flash ROM:
drom0_boftable_seg (R) : org = 0x3F400018, len = 0x100 /* Data table */
We defined a SECTION (in esp32.common.ld):
.drom0_boftable 0x3F400018 :
{
KEEP(*(.bof_table))
} > drom0_boftable_seg
We defined the data table in a project code module:
const BOFTablePtr_s _MainAppDT[] __attribute__((__section__(".bof_table"))) = {
/* 1st Vector */
<pointer 1>,
/* 2nd Vector */
<pointer 2>,
/* Last Vector */
(void*)NULL
};
We feel that we're close, so any help you can offer will be gratefully received.
Re: Using a linker script in GCC to locate functions at specific memory regions
I think I understand. You want to read this metadata externally, yes? ie the application runs on a computer and parses the .bin files.
If so, writing to a fixed memory address only gets you part way. Because the ESP32 has an MMU, there's no guarantee that a virtual memory address (like 0x3F400018) corresponds to a particular address in the .bin file. You'd need to parse the .bin file format in order to determine that information.
(This is different on a much simpler micro like the one you linked, where there's no MMU and the physical flash layout always has a fixed correspondence to the virtual address space.)
You can do it that way, but it's a lot of extra complexity that I would recommend avoiding.
One other way is to append the information "out of band" to the .bin file:
If so, writing to a fixed memory address only gets you part way. Because the ESP32 has an MMU, there's no guarantee that a virtual memory address (like 0x3F400018) corresponds to a particular address in the .bin file. You'd need to parse the .bin file format in order to determine that information.
(This is different on a much simpler micro like the one you linked, where there's no MMU and the physical flash layout always has a fixed correspondence to the virtual address space.)
You can do it that way, but it's a lot of extra complexity that I would recommend avoiding.
One other way is to append the information "out of band" to the .bin file:
- Generate the .bin file normally from the build process
- Pad the .bin file with 0xFFs to (Size of partition - 0x100)
- Append the 0x100 bytes (or whatever) of metadata there
- Read it from an external app by seeking to the end of the .bin file, or read it from inside the ESP32 with esp_partition_mmap().
Who is online
Users browsing this forum: Bing [Bot] and 108 guests