With idf v5.2 the following code for an esp32 does'nt compile anymore:
Code: Select all
static void start_ulp()
{
rtc_gpio_init(GPIO_NUM_25);
rtc_gpio_set_direction(GPIO_NUM_25, RTC_GPIO_MODE_OUTPUT_ONLY);
rtc_gpio_init(SCL_PIN);
rtc_gpio_set_direction(SCL_PIN, RTC_GPIO_MODE_INPUT_ONLY);
rtc_gpio_init(SDA_PIN);
rtc_gpio_set_direction(SDA_PIN, RTC_GPIO_MODE_INPUT_ONLY);
ESP_ERROR_CHECK(ulp_load_binary(0, ulp_main_bin_start, (ulp_main_bin_end - ulp_main_bin_start)/sizeof(uint32_t)));
//REG_SET_FIELD(SENS_ULP_CP_SLEEP_CYC0_REG, SENS_SLEEP_CYCLES_S0,rtc_time_us_to_slowclk((uint64_t)(SENSE_INTERVAL) * 990000,rtc_clk_cal(RTC_CAL_RTC_MUX , CLOCK_MEASURE)));
REG_SET_FIELD(SENS_ULP_CP_SLEEP_CYC0_REG, SENS_SLEEP_CYCLES_S0,rtc_time_us_to_slowclk((uint64_t)(SENSE_INTERVAL) * 999056,rtc_clk_cal(RTC_CAL_RTC_MUX , CLOCK_MEASURE)));
//ESP_LOGI(TAG, "SENS_ULP_CP_SLEEP_CYC0_REG = %d", READ_PERI_REG(SENS_ULP_CP_SLEEP_CYC0_REG));
ESP_ERROR_CHECK( ulp_run((&ulp_entry - RTC_SLOW_MEM) / sizeof(uint32_t)) );
printf("Initiate deepsleepcounter\n");
uint32_t *deepsleepcounter = &ulp_deepsleepcounter;
if ((get_nextOffload() >= 30) && (get_nextOffload() <= LIMIT_WAKEUP)){
deepsleepcounter[0] = get_nextOffload()/15;
//printf("Normal init deepsleepcounter %d \n",deepsleepcounter[0]);
}else{
deepsleepcounter[0] = RETRY_TIME/15;
//printf("Retry init Deepsleepcounter %d \n",deepsleepcounter[0]);
}
printf("Initiate display matrix\n");
uint32_t *tmp102config = &ulp_tmp102config;
tmp102config[0] = 0x0030; //mark read and tx
uint32_t *counter = &ulp_counter;
counter[0] = 0;
uint32_t *displayl = &ulp_displayl;
displayl[0] = (uint32_t)get_display();// && 0x0000FFFF;
uint32_t *displayh = &ulp_displayh;
displayh[0] = (uint32_t)get_display() >> 16;
uint32_t *intNumber = &ulp_intNumber;
uint32_t *deciNumber = &ulp_deciNumber;
intNumber[0] = 0x003F; intNumber[1] = 0x0006; intNumber[2] = 0x005B; intNumber[3] = 0x004F; intNumber[4] = 0x0066; intNumber[5] = 0x006D; intNumber[6] = 0x007D; intNumber[7] = 0x0007; intNumber[8] = 0x007F; intNumber[9] = 0x006F;
intNumber[10] = 0x063F; intNumber[11] = 0x0606; intNumber[12] = 0x065B; intNumber[13] = 0x064F; intNumber[14] = 0x0666; intNumber[15] = 0x066D; intNumber[16] = 0x067D; intNumber[17] = 0x0607; intNumber[18] = 0x067F; intNumber[19] = 0x066F;
intNumber[20] = 0x5B3F; intNumber[21] = 0x5B06; intNumber[22] = 0x5B5B; intNumber[23] = 0x5B4F; intNumber[24] = 0x5B66; intNumber[25] = 0x5B6D; intNumber[26] = 0x5B7D; intNumber[27] = 0x5B07; intNumber[28] = 0x5B7F; intNumber[29] = 0x5B6F;
intNumber[30] = 0x4F3F; intNumber[31] = 0x4F06; intNumber[32] = 0x4F5B; intNumber[33] = 0x4F4F; intNumber[34] = 0x4F66; intNumber[35] = 0x4F6D; intNumber[36] = 0x4F7D; intNumber[37] = 0x4F07; intNumber[38] = 0x4F7F; intNumber[39] = 0x4F6F;
intNumber[40] = 0x663F; intNumber[41] = 0x6606; intNumber[42] = 0x665B; intNumber[43] = 0x664F; intNumber[44] = 0x6666; intNumber[45] = 0x666D; intNumber[46] = 0x667D; intNumber[47] = 0x6607; intNumber[48] = 0x667F; intNumber[49] = 0x666F;
intNumber[50] = 0x6D3F; intNumber[51] = 0x6D06; intNumber[52] = 0x6D5B; intNumber[53] = 0x6D4F; intNumber[54] = 0x6D66; intNumber[55] = 0x6D6D; intNumber[56] = 0x6D7D; intNumber[57] = 0x6D07; intNumber[58] = 0x6D7F; intNumber[59] = 0x6D6F;
intNumber[60] = 0x7D3F; intNumber[61] = 0x7D06; intNumber[62] = 0x7D5B; intNumber[63] = 0x7D4F; intNumber[64] = 0x7D66; intNumber[65] = 0x7D6D; intNumber[66] = 0x7D7D; intNumber[67] = 0x7D07; intNumber[68] = 0x7D7F; intNumber[69] = 0x7D6F;
intNumber[70] = 0x4040;
deciNumber[0] = 0xBF;//0x3F;//0
deciNumber[1] = 0x86;//0x06;//1
deciNumber[2] = 0x86;//0x06;//1
deciNumber[3] = 0xDB;//0x5B;//2
deciNumber[4] = 0xDB;//0x5B;//2
deciNumber[5] = 0xCF;//0x4F;//3
deciNumber[6] = 0xE6;//0x66;//4
deciNumber[7] = 0xE6;//0x66;
deciNumber[8] = 0xED;//0x6D;//5
deciNumber[9] = 0xFD;//0x7D;//6
deciNumber[10] = 0xFD;//0x7D;
deciNumber[11] = 0x87;//0x07;//7
deciNumber[12] = 0x87;//0x07;
deciNumber[13] = 0xFF;//0x7F;//8
deciNumber[14] = 0xEF;//0x6F;
deciNumber[15] = 0xEF;//0x6F;//9
struct timeval now; //Var for boottime measurement
gettimeofday(&now, NULL);
start_log_time = now.tv_sec;
}
Code: Select all
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/main/main.c:139:40: error: array subscript 1 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Werror=array-bounds=]
139 | intNumber[0] = 0x003F; intNumber[1] = 0x0006; intNumber[2] = 0x005B; intNumber[3] = 0x004F; intNumber[4] = 0x0066; intNumber[5] = 0x006D; intNumber[6] = 0x007D; intNumber[7] = 0x0007; intNumber[8] = 0x007F; intNumber[9] = 0x006F;
| ~~~~~~~~~^~~
In file included from Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/main/main.c:49:
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/build/esp-idf/main/ulp_main/ulp_main.h:26:17: note: at offset 4 into object 'ulp_intNumber' of size 4
26 | extern uint32_t ulp_intNumber;
| ^~~~~~~~~~~~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/main/main.c:139:66: error: array subscript 2 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Werror=array-bounds=]
139 | intNumber[0] = 0x003F; intNumber[1] = 0x0006; intNumber[2] = 0x005B; intNumber[3] = 0x004F; intNumber[4] = 0x0066; intNumber[5] = 0x006D; intNumber[6] = 0x007D; intNumber[7] = 0x0007; intNumber[8] = 0x007F; intNumber[9] = 0x006F;
| ~~~~~~~~~^~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/build/esp-idf/main/ulp_main/ulp_main.h:26:17: note: at offset 8 into object 'ulp_intNumber' of size 4
26 | extern uint32_t ulp_intNumber;
| ^~~~~~~~~~~~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/main/main.c:139:92: error: array subscript 3 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Werror=array-bounds=]
139 | intNumber[0] = 0x003F; intNumber[1] = 0x0006; intNumber[2] = 0x005B; intNumber[3] = 0x004F; intNumber[4] = 0x0066; intNumber[5] = 0x006D; intNumber[6] = 0x007D; intNumber[7] = 0x0007; intNumber[8] = 0x007F; intNumber[9] = 0x006F;
| ~~~~~~~~~^~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/build/esp-idf/main/ulp_main/ulp_main.h:26:17: note: at offset 12 into object 'ulp_intNumber' of size 4
26 | extern uint32_t ulp_intNumber;
| ^~~~~~~~~~~~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/main/main.c:139:118: error: array subscript 4 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Werror=array-bounds=]
139 | intNumber[0] = 0x003F; intNumber[1] = 0x0006; intNumber[2] = 0x005B; intNumber[3] = 0x004F; intNumber[4] = 0x0066; intNumber[5] = 0x006D; intNumber[6] = 0x007D; intNumber[7] = 0x0007; intNumber[8] = 0x007F; intNumber[9] = 0x006F;
| ~~~~~~~~~^~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/build/esp-idf/main/ulp_main/ulp_main.h:26:17: note: at offset 16 into object 'ulp_intNumber' of size 4
26 | extern uint32_t ulp_intNumber;
| ^~~~~~~~~~~~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/main/main.c:139:144: error: array subscript 5 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Werror=array-bounds=]
139 | intNumber[0] = 0x003F; intNumber[1] = 0x0006; intNumber[2] = 0x005B; intNumber[3] = 0x004F; intNumber[4] = 0x0066; intNumber[5] = 0x006D; intNumber[6] = 0x007D; intNumber[7] = 0x0007; intNumber[8] = 0x007F; intNumber[9] = 0x006F;
|
~~~~~~~~~^~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/build/esp-idf/main/ulp_main/ulp_main.h:26:17: note: at offset 20 into object 'ulp_intNumber' of size 4
26 | extern uint32_t ulp_intNumber;
| ^~~~~~~~~~~~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/main/main.c:139:170: error: array subscript 6 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Werror=array-bounds=]
139 | intNumber[0] = 0x003F; intNumber[1] = 0x0006; intNumber[2] = 0x005B; intNumber[3] = 0x004F; intNumber[4] = 0x0066; intNumber[5] = 0x006D; intNumber[6] = 0x007D; intNumber[7] = 0x0007; intNumber[8] = 0x007F; intNumber[9] = 0x006F;
|
~~~~~~~~~^~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/build/esp-idf/main/ulp_main/ulp_main.h:26:17: note: at offset 24 into object 'ulp_intNumber' of size 4
26 | extern uint32_t ulp_intNumber;
| ^~~~~~~~~~~~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/main/main.c:139:196: error: array subscript 7 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Werror=array-bounds=]
139 | intNumber[0] = 0x003F; intNumber[1] = 0x0006; intNumber[2] = 0x005B; intNumber[3] = 0x004F; intNumber[4] = 0x0066; intNumber[5] = 0x006D; intNumber[6] = 0x007D; intNumber[7] = 0x0007; intNumber[8] = 0x007F; intNumber[9] = 0x006F;
|
~~~~~~~~~^~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/build/esp-idf/main/ulp_main/ulp_main.h:26:17: note: at offset 28 into object 'ulp_intNumber' of size 4
26 | extern uint32_t ulp_intNumber;
| ^~~~~~~~~~~~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/main/main.c:139:222: error: array subscript 8 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Werror=array-bounds=]
139 | intNumber[0] = 0x003F; intNumber[1] = 0x0006; intNumber[2] = 0x005B; intNumber[3] = 0x004F; intNumber[4] = 0x0066; intNumber[5] = 0x006D; intNumber[6] = 0x007D; intNumber[7] = 0x0007; intNumber[8] = 0x007F; intNumber[9] = 0x006F;
|
~~~~~~~~~^~~
Y:/VM/eclipse-workspace/bat_sl_ulp_ijzer_temploggerC/build/esp-idf/main/ulp_main/ulp_main.h:26:17: note: at offset 32 into object 'ulp_intNumber' of size 4
26 | extern uint32_t ulp_intNumber;
.....
The issue seems to be the interpretation of uint32_t as unsigned long int vs as just an unsigned int.
Any suggestion's to fix or workaround? Using #include <inttypes.h> doesn't seem to work.
Thanks,
Gino