Skip to content

Commit

Permalink
feat(elf_loader): Add support for linking other components to ELF file
Browse files Browse the repository at this point in the history
  • Loading branch information
cwespressif committed Dec 19, 2024
1 parent 4638426 commit 2f956b7
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions components/elf_loader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ChangeLog

## v1.0.0 - 2024-12-09

* Added support for the following RISC-V chips: ESP32-P4 and ESP32-C6
* Added support for linking other components to ELF file

## v0.1.0 - 2023-08-14

* Add basic ELF loader component
2 changes: 1 addition & 1 deletion components/elf_loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Add a dependency on this component in your component or project's idf_component.

```yml
dependencies:
espressif/elf_loader: "0.*"
espressif/elf_loader: "1.*"
```

Enable ELF loader in the menuconfig:
Expand Down
4 changes: 2 additions & 2 deletions components/elf_loader/elf_loader.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ macro(project_elf project_name)
endif()

# Link input list of libraries to ELF
list(APPEND ELF_COMPONENTS "main")
list(PREPEND ELF_COMPONENTS "main")
if(ELF_COMPONENTS)
foreach(c "${ELF_COMPONENTS}")
foreach(c ${ELF_COMPONENTS})
list(APPEND elf_libs "esp-idf/${c}/lib${c}.a")
list(APPEND elf_dependeces "idf::${c}")
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion components/elf_loader/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.1.0"
version: "1.0.0"
description: Espressif ELF(Executable and Linkable Format) Loader
url: https://github.com/espressif/esp-iot-solution/tree/master/components/elf_loader
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion components/elf_loader/include/private/elf_symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#pragma once

#include "private/elf_types.h"
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 4 additions & 0 deletions components/elf_loader/src/esp_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ int esp_elf_relocate(esp_elf_t *elf, const uint8_t *pbuf)
*/
int esp_elf_request(esp_elf_t *elf, int opt, int argc, char *argv[])
{
if (!elf || !(elf->entry)) {
return -EINVAL;
}

elf->entry(argc, argv);

return 0;
Expand Down
3 changes: 3 additions & 0 deletions examples/elf_loader/build_elf_file_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(hello_world)

# Set other components to link to the ELF file
# e.g: set(ELF_COMPONENTS "log" "esp_wifi")

include(elf_loader)
project_elf(hello_world)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies:
elf_loader:
version: "0.*"
version: "1.*"
override_path: "../../../../components/elf_loader"
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ targets:
- esp32p4
dependencies:
elf_loader:
version: "0.*"
version: "1.*"
override_path: "../../../../components/elf_loader"

0 comments on commit 2f956b7

Please sign in to comment.