mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ci: add a test for .eh_frame(_hdr) section for RISC-V targets
This commit is contained in:
parent
fa9856c815
commit
3c1b8cd75a
6
tools/test_apps/system/eh_frame/CMakeLists.txt
Normal file
6
tools/test_apps/system/eh_frame/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
# The following lines of boilerplate have to be in your project's CMakeLists
|
||||
# in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(eh_frame)
|
16
tools/test_apps/system/eh_frame/README.md
Normal file
16
tools/test_apps/system/eh_frame/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
| Supported Targets | ESP32-C3 | ESP32-H2 | ESP32-C2 |
|
||||
| ----------------- | -------- | -------- | -------- |
|
||||
|
||||
# Building and running
|
||||
|
||||
The main goal of this test is to check whether the compiler/linker generates non-empty sections `.eh_frame` and `.eh_frame_hdr`.
|
||||
|
||||
Thus, as soon as this example compiles we can considered it passed. However, it will also print the addresses of both sections on the UART.
|
||||
|
||||
In order to build and run the example, use the following commands:
|
||||
|
||||
```
|
||||
idf.py set-target <esp32c3/esp32h2/esp32c2>
|
||||
idf.py build
|
||||
idf.py flash monitor
|
||||
```
|
3
tools/test_apps/system/eh_frame/main/CMakeLists.txt
Normal file
3
tools/test_apps/system/eh_frame/main/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
idf_component_register(SRCS "eh_frame_main.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES esp_system)
|
40
tools/test_apps/system/eh_frame/main/eh_frame_main.c
Normal file
40
tools/test_apps/system/eh_frame/main/eh_frame_main.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* @brief Symbols defined by the linker.
|
||||
* Retrieve the addresses of both .eh_frame_hdr and .eh_frame sections.
|
||||
*/
|
||||
extern char __eh_frame_hdr;
|
||||
extern char __eh_frame_hdr_end;
|
||||
extern char __eh_frame;
|
||||
extern char __eh_frame_end;
|
||||
|
||||
/**
|
||||
* @brief Pointers to both .eh_frame_hdr and .eh_frame sections.
|
||||
*/
|
||||
#define EH_FRAME_HDR_ADDR ((void*) (&__eh_frame_hdr))
|
||||
#define EH_FRAME_HDR_END_ADDR ((void*) (&__eh_frame_hdr_end))
|
||||
#define EH_FRAME_ADDR ((void*) (&__eh_frame))
|
||||
#define EH_FRAME_END_ADDR ((void*) (&__eh_frame_end))
|
||||
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
/* As soon as this test compiles, it can be considered passed. The linker should
|
||||
* test that the eh_frame and eh_frame_hdr sections are not empty but let's make
|
||||
* sure again that they are not empty. */
|
||||
assert((EH_FRAME_END_ADDR > EH_FRAME_ADDR) && ".eh_frame section must not be empty");
|
||||
assert((EH_FRAME_HDR_END_ADDR > EH_FRAME_HDR_ADDR) && ".eh_frame_hdr section must not be empty");
|
||||
|
||||
/* Use the symbols just to make sure they won't be optimized away */
|
||||
printf(".eh_frame start: %p, end: %p\n", EH_FRAME_ADDR, EH_FRAME_END_ADDR);
|
||||
printf(".eh_frame_hdr start: %p, end: %p\n", EH_FRAME_HDR_ADDR, EH_FRAME_HDR_END_ADDR);
|
||||
}
|
2
tools/test_apps/system/eh_frame/sdkconfig.defaults
Normal file
2
tools/test_apps/system/eh_frame/sdkconfig.defaults
Normal file
@ -0,0 +1,2 @@
|
||||
# Enable eh_frame sections generation
|
||||
CONFIG_ESP_SYSTEM_USE_EH_FRAME=y
|
Loading…
Reference in New Issue
Block a user