mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 06:34:34 +02:00
Merge branch 'bugfix/ulp_warnings' into 'master'
ulp: minor fixes of warnings See merge request espressif/esp-idf!18309
This commit is contained in:
@@ -50,8 +50,12 @@ static void hexdump(const uint32_t* src, size_t count) {
|
||||
|
||||
TEST_CASE("ULP FSM addition test", "[ulp]")
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* ULP co-processor program to add data in 2 memory locations using ULP macros */
|
||||
const ulp_insn_t program[] = {
|
||||
@@ -84,8 +88,12 @@ TEST_CASE("ULP FSM subtraction and branch test", "[ulp]")
|
||||
{
|
||||
assert(CONFIG_ULP_COPROC_RESERVE_MEM >= 260 && "this test needs ULP_COPROC_RESERVE_MEM option set in menuconfig");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* ULP co-processor program to perform subtractions and branch to a label */
|
||||
const ulp_insn_t program[] = {
|
||||
@@ -155,8 +163,12 @@ TEST_CASE("ULP FSM light-sleep wakeup test", "[ulp]")
|
||||
{
|
||||
assert(CONFIG_ULP_COPROC_RESERVE_MEM >= 260 && "this test needs ULP_COPROC_RESERVE_MEM option set in menuconfig");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* ULP co-processor program to perform some activities and wakeup the main CPU from deep-sleep */
|
||||
const ulp_insn_t program[] = {
|
||||
@@ -197,8 +209,12 @@ TEST_CASE("ULP FSM deep-sleep wakeup test", "[ulp][reset=SW_CPU_RESET][ignore]")
|
||||
{
|
||||
assert(CONFIG_ULP_COPROC_RESERVE_MEM >= 260 && "this test needs ULP_COPROC_RESERVE_MEM option set in menuconfig");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clearout the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* ULP co-processor program to perform some activities and wakeup the main CPU from deep-sleep */
|
||||
const ulp_insn_t program[] = {
|
||||
@@ -239,8 +255,12 @@ TEST_CASE("ULP FSM can write and read peripheral registers", "[ulp]")
|
||||
/* Clear ULP timer */
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* ULP co-processor program to read from and write to peripheral registers */
|
||||
const ulp_insn_t program[] = {
|
||||
@@ -288,8 +308,12 @@ TEST_CASE("ULP FSM I_WR_REG instruction test", "[ulp]")
|
||||
{
|
||||
assert(CONFIG_ULP_COPROC_RESERVE_MEM >= 260 && "this test needs ULP_COPROC_RESERVE_MEM option set in menuconfig");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* Define the test set */
|
||||
typedef struct {
|
||||
@@ -354,8 +378,12 @@ TEST_CASE("ULP FSM controls RTC_IO", "[ulp][ignore]")
|
||||
{
|
||||
assert(CONFIG_ULP_COPROC_RESERVE_MEM >= 260 && "this test needs ULP_COPROC_RESERVE_MEM option set in menuconfig");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* ULP co-processor program to toggle LED */
|
||||
const ulp_insn_t program[] = {
|
||||
@@ -416,12 +444,20 @@ TEST_CASE("ULP FSM power consumption in deep sleep", "[ulp][ignore]")
|
||||
{
|
||||
assert(CONFIG_ULP_COPROC_RESERVE_MEM >= 4 && "this test needs ULP_COPROC_RESERVE_MEM option set in menuconfig");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* Put the ULP coprocessor in halt state */
|
||||
ulp_insn_t insn = I_HALT();
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
memcpy(&RTC_SLOW_MEM[0], &insn, sizeof(insn));
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* Set ULP timer */
|
||||
ulp_set_wakeup_period(0, 0x8000);
|
||||
@@ -442,8 +478,12 @@ TEST_CASE("ULP FSM timer setting", "[ulp]")
|
||||
{
|
||||
assert(CONFIG_ULP_COPROC_RESERVE_MEM >= 32 && "this test needs ULP_COPROC_RESERVE_MEM option set in menuconfig");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/*
|
||||
* Run a simple ULP program which increments the counter, for one second.
|
||||
@@ -503,8 +543,12 @@ TEST_CASE("ULP FSM can use temperature sensor (TSENS) in deep sleep", "[ulp][ign
|
||||
{
|
||||
assert(CONFIG_ULP_COPROC_RESERVE_MEM >= 260 && "this test needs ULP_COPROC_RESERVE_MEM option set in menuconfig");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// Allow TSENS to be controlled by the ULP
|
||||
SET_PERI_REG_BITS(SENS_SAR_TSENS_CTRL_REG, SENS_TSENS_CLK_DIV, 10, SENS_TSENS_CLK_DIV_S);
|
||||
@@ -571,8 +615,12 @@ TEST_CASE("ULP FSM can use ADC in deep sleep", "[ulp][ignore]")
|
||||
const int channel = 0;
|
||||
const int atten = 0;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* Clear the RTC_SLOW_MEM region for the ULP co-processor binary to be loaded */
|
||||
memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
// Configure SAR ADCn resolution
|
||||
|
@@ -159,8 +159,12 @@ esp_err_t ulp_riscv_load_binary(const uint8_t* program_binary, size_t program_si
|
||||
uint8_t* base = (uint8_t*) RTC_SLOW_MEM;
|
||||
|
||||
//Start by clearing memory reserved with zeros, this will also will initialize the bss:
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
memset(base, 0, CONFIG_ULP_COPROC_RESERVE_MEM);
|
||||
memcpy(base, program_binary, program_size_bytes);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user