Skip to content

Commit

Permalink
Add ESP-IDF component files
Browse files Browse the repository at this point in the history
  • Loading branch information
reznikmm committed Aug 24, 2021
1 parent 3a38a9d commit a8dbf20
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
idf_component_register(
SRCS
"common/adaint.c"
"common/freertos_bindings.c"
"common/last_chance_handler.c"
"common/vApplicationStackOverflowHook.c"
REQUIRES freertos)

idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos
ORIG_INCLUDE_PATH)

target_include_directories (${COMPONENT_LIB} PRIVATE
${FREERTOS_ORIG_INCLUDE_PATH})

# Build GNAT RTS in ${BUILD_DIR}/rts
add_custom_command(OUTPUT ${BUILD_DIR}/rts/adalib/libgnat.a
COMMAND gprbuild -p -P ${COMPONENT_DIR}/esp32/build_runtime.gpr
--db ${COMPONENT_DIR}/gprconfig
--autoconf=${BUILD_DIR}/config.cgpr
&& gprinstall -p -P ${COMPONENT_DIR}/esp32/build_runtime.gpr
--prefix=${BUILD_DIR}/rts
--autoconf=${BUILD_DIR}/config.cgpr
DEPENDS ${COMPONENT_DIR}/common/ ${COMPONENT_DIR}/esp32/adainclude/
VERBATIM)

add_custom_target(gnat DEPENDS ${BUILD_DIR}/rts/adalib/libgnat.a)
add_dependencies(${COMPONENT_LIB} gnat)
target_link_libraries(${COMPONENT_LIB} ${BUILD_DIR}/rts/adalib/libgnat.a)
17 changes: 17 additions & 0 deletions gprconfig/linker-esp32.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" ?>
<gprconfig>
<configuration>
<targets>
<target name=".*-elf$" />
</targets>
<config>
for Archive_Builder use ("${TARGET}-ar", "cr");
for Archive_Builder_Append_Option use ("q");
for Archive_Indexer use ("${TARGET}-ranlib");
for Archive_Suffix use ".a";
for Library_Support use "static_only";
for Library_Builder use "${GPRCONFIG_PREFIX}libexec/gprbuild/gprlib";
</config>
</configuration>

</gprconfig>

0 comments on commit a8dbf20

Please sign in to comment.