Skip to content

Commit 7b6f020

Browse files
vikramdattuigrr
authored andcommitted
Fixed build errors for IDF version release-v5.0
1. Fixed new errors introduced due to removal of -Wno-error=format flag 2. Added CI on `release-v5.0` tag Signed-off-by: Vikram <[email protected]>
1 parent a6f13d9 commit 7b6f020

File tree

6 files changed

+62
-38
lines changed

6 files changed

+62
-38
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@ jobs:
2222
target: ${{ matrix.idf_target }}
2323
path: 'examples'
2424

25+
build-release-v5_0:
26+
name: Build for ${{ matrix.idf_target }} on ${{ matrix.idf_ver }}
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
idf_ver: ["release-v5.0"]
31+
idf_target: ["esp32", "esp32s2", "esp32s3"]
32+
steps:
33+
- name: Checkout repo
34+
uses: actions/checkout@v2
35+
with:
36+
submodules: 'recursive'
37+
- name: esp-idf build
38+
uses: espressif/esp-idf-ci-action@main
39+
with:
40+
esp_idf_version: ${{ matrix.idf_ver }}
41+
target: ${{ matrix.idf_target }}
42+
path: 'examples'
43+
2544
build-release-v4_4:
2645
name: Build for ${{ matrix.idf_target }} on ${{ matrix.idf_ver }}
2746
runs-on: ubuntu-latest

driver/cam_hal.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static int cam_verify_jpeg_soi(const uint8_t *inbuf, uint32_t length)
4545
for (uint32_t i = 0; i < length; i++) {
4646
sig = *((uint32_t *)(&inbuf[i])) & 0xFFFFFF;
4747
if (sig == JPEG_SOI_MARKER) {
48-
ESP_LOGW(TAG, "SOI: %d", i);
48+
ESP_LOGW(TAG, "SOI: %d", (int) i);
4949
return i;
5050
}
5151
}
@@ -117,7 +117,7 @@ static void cam_task(void *arg)
117117
int frame_pos = 0;
118118
cam_obj->state = CAM_STATE_IDLE;
119119
cam_event_t cam_event = 0;
120-
120+
121121
xQueueReset(cam_obj->event_queue);
122122

123123
while (1) {
@@ -140,7 +140,7 @@ static void cam_task(void *arg)
140140
case CAM_STATE_READ_BUF: {
141141
camera_fb_t * frame_buffer_event = &cam_obj->frames[frame_pos].fb;
142142
size_t pixels_per_dma = (cam_obj->dma_half_buffer_size * cam_obj->fb_bytes_per_pixel) / (cam_obj->dma_bytes_per_item * cam_obj->in_bytes_per_pixel);
143-
143+
144144
if (cam_event == CAM_IN_SUC_EOF_EVENT) {
145145
if(!cam_obj->psram_mode){
146146
if (cam_obj->fb_size < (frame_buffer_event->len + pixels_per_dma)) {
@@ -150,8 +150,8 @@ static void cam_task(void *arg)
150150
continue;
151151
}
152152
frame_buffer_event->len += ll_cam_memcpy(cam_obj,
153-
&frame_buffer_event->buf[frame_buffer_event->len],
154-
&cam_obj->dma_buffer[(cnt % cam_obj->dma_half_buffer_cnt) * cam_obj->dma_half_buffer_size],
153+
&frame_buffer_event->buf[frame_buffer_event->len],
154+
&cam_obj->dma_buffer[(cnt % cam_obj->dma_half_buffer_cnt) * cam_obj->dma_half_buffer_size],
155155
cam_obj->dma_half_buffer_size);
156156
}
157157
//Check for JPEG SOI in the first buffer. stop if not found
@@ -173,8 +173,8 @@ static void cam_task(void *arg)
173173
cnt--;
174174
} else {
175175
frame_buffer_event->len += ll_cam_memcpy(cam_obj,
176-
&frame_buffer_event->buf[frame_buffer_event->len],
177-
&cam_obj->dma_buffer[(cnt % cam_obj->dma_half_buffer_cnt) * cam_obj->dma_half_buffer_size],
176+
&frame_buffer_event->buf[frame_buffer_event->len],
177+
&cam_obj->dma_buffer[(cnt % cam_obj->dma_half_buffer_cnt) * cam_obj->dma_half_buffer_size],
178178
cam_obj->dma_half_buffer_size);
179179
}
180180
}
@@ -192,7 +192,7 @@ static void cam_task(void *arg)
192192
} else if (!cam_obj->jpeg_mode) {
193193
if (frame_buffer_event->len != cam_obj->fb_size) {
194194
cam_obj->frames[frame_pos].en = 1;
195-
ESP_LOGE(TAG, "FB-SIZE: %u != %u", frame_buffer_event->len, cam_obj->fb_size);
195+
ESP_LOGE(TAG, "FB-SIZE: %u != %u", frame_buffer_event->len, (unsigned) cam_obj->fb_size);
196196
}
197197
}
198198
//send frame
@@ -258,8 +258,9 @@ static esp_err_t cam_dma_config(const camera_config_t *config)
258258
cam_obj->dma_node_cnt = (cam_obj->dma_buffer_size) / cam_obj->dma_node_buffer_size; // Number of DMA nodes
259259
cam_obj->frame_copy_cnt = cam_obj->recv_size / cam_obj->dma_half_buffer_size; // Number of interrupted copies, ping-pong copy
260260

261-
ESP_LOGI(TAG, "buffer_size: %d, half_buffer_size: %d, node_buffer_size: %d, node_cnt: %d, total_cnt: %d",
262-
cam_obj->dma_buffer_size, cam_obj->dma_half_buffer_size, cam_obj->dma_node_buffer_size, cam_obj->dma_node_cnt, cam_obj->frame_copy_cnt);
261+
ESP_LOGI(TAG, "buffer_size: %d, half_buffer_size: %d, node_buffer_size: %d, node_cnt: %d, total_cnt: %d",
262+
(int) cam_obj->dma_buffer_size, (int) cam_obj->dma_half_buffer_size, (int) cam_obj->dma_node_buffer_size,
263+
(int) cam_obj->dma_node_cnt, (int) cam_obj->frame_copy_cnt);
263264

264265
cam_obj->dma_buffer = NULL;
265266
cam_obj->dma = NULL;
@@ -295,7 +296,7 @@ static esp_err_t cam_dma_config(const camera_config_t *config)
295296
//align PSRAM buffer. TODO: save the offset so proper address can be freed later
296297
cam_obj->frames[x].fb_offset = dma_align - ((uint32_t)cam_obj->frames[x].fb.buf & (dma_align - 1));
297298
cam_obj->frames[x].fb.buf += cam_obj->frames[x].fb_offset;
298-
ESP_LOGI(TAG, "Frame[%d]: Offset: %u, Addr: 0x%08X", x, cam_obj->frames[x].fb_offset, (uint32_t)cam_obj->frames[x].fb.buf);
299+
ESP_LOGI(TAG, "Frame[%d]: Offset: %u, Addr: 0x%08X", x, cam_obj->frames[x].fb_offset, (unsigned) cam_obj->frames[x].fb.buf);
299300
cam_obj->frames[x].dma = allocate_dma_descriptors(cam_obj->dma_node_cnt, cam_obj->dma_node_buffer_size, cam_obj->frames[x].fb.buf);
300301
CAM_CHECK(cam_obj->frames[x].dma != NULL, "frame dma malloc failed", ESP_FAIL);
301302
}
@@ -305,8 +306,8 @@ static esp_err_t cam_dma_config(const camera_config_t *config)
305306
if (!cam_obj->psram_mode) {
306307
cam_obj->dma_buffer = (uint8_t *)heap_caps_malloc(cam_obj->dma_buffer_size * sizeof(uint8_t), MALLOC_CAP_DMA);
307308
if(NULL == cam_obj->dma_buffer) {
308-
ESP_LOGE(TAG,"%s(%d): DMA buffer %d Byte malloc failed, the current largest free block:%d Byte", __FUNCTION__, __LINE__,
309-
cam_obj->dma_buffer_size, heap_caps_get_largest_free_block(MALLOC_CAP_DMA));
309+
ESP_LOGE(TAG,"%s(%d): DMA buffer %d Byte malloc failed, the current largest free block:%d Byte", __FUNCTION__, __LINE__,
310+
(int) cam_obj->dma_buffer_size, (int) heap_caps_get_largest_free_block(MALLOC_CAP_DMA));
310311
return ESP_FAIL;
311312
}
312313

@@ -372,7 +373,7 @@ esp_err_t cam_config(const camera_config_t *config, framesize_t frame_size, uint
372373
cam_obj->recv_size = cam_obj->width * cam_obj->height * cam_obj->in_bytes_per_pixel;
373374
cam_obj->fb_size = cam_obj->width * cam_obj->height * cam_obj->fb_bytes_per_pixel;
374375
}
375-
376+
376377
ret = cam_dma_config(config);
377378
CAM_CHECK_GOTO(ret == ESP_OK, "cam_dma_config failed", err);
378379

@@ -389,7 +390,7 @@ esp_err_t cam_config(const camera_config_t *config, framesize_t frame_size, uint
389390
ret = ll_cam_init_isr(cam_obj);
390391
CAM_CHECK_GOTO(ret == ESP_OK, "cam intr alloc failed", err);
391392

392-
393+
393394
#if CONFIG_CAMERA_CORE0
394395
xTaskCreatePinnedToCore(cam_task, "cam_task", 2048, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 0);
395396
#elif CONFIG_CAMERA_CORE1

target/esp32/ll_cam.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ esp_err_t ll_cam_config(cam_obj_t *cam, const camera_config_t *config)
312312
I2S0.clkm_conf.clkm_div_a = 0;
313313
I2S0.clkm_conf.clkm_div_b = 0;
314314
I2S0.clkm_conf.clkm_div_num = 2;
315-
315+
316316
I2S0.fifo_conf.dscr_en = 1;
317317
I2S0.fifo_conf.rx_fifo_mod = sampling_mode;
318318
I2S0.fifo_conf.rx_fifo_mod_force_en = 1;
@@ -446,9 +446,12 @@ static bool ll_cam_calc_rgb_dma(cam_obj_t *cam){
446446
}
447447
// Calculate DMA size
448448
dma_buffer_size =(dma_buffer_max / dma_half_buffer) * dma_half_buffer;
449-
450-
ESP_LOGI(TAG, "node_size: %4u, nodes_per_line: %u, lines_per_node: %u, dma_half_buffer_min: %5u, dma_half_buffer: %5u, lines_per_half_buffer: %2u, dma_buffer_size: %5u, image_size: %u",
451-
node_size * cam->dma_bytes_per_item, nodes_per_line, lines_per_node, dma_half_buffer_min * cam->dma_bytes_per_item, dma_half_buffer * cam->dma_bytes_per_item, lines_per_half_buffer, dma_buffer_size * cam->dma_bytes_per_item, image_size);
449+
450+
ESP_LOGI(TAG, "node_size: %4u, nodes_per_line: %u, lines_per_node: %u, dma_half_buffer_min: %5u, dma_half_buffer: %5u,"
451+
"lines_per_half_buffer: %2u, dma_buffer_size: %5u, image_size: %u",
452+
(unsigned) (node_size * cam->dma_bytes_per_item), (unsigned) nodes_per_line, (unsigned) lines_per_node,
453+
(unsigned) (dma_half_buffer_min * cam->dma_bytes_per_item), (unsigned) (dma_half_buffer * cam->dma_bytes_per_item),
454+
(unsigned) (lines_per_half_buffer), (unsigned) (dma_buffer_size * cam->dma_bytes_per_item), (unsigned) image_size);
452455

453456
cam->dma_buffer_size = dma_buffer_size * cam->dma_bytes_per_item;
454457
cam->dma_half_buffer_size = dma_half_buffer * cam->dma_bytes_per_item;

target/esp32s2/ll_cam.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ bool ll_cam_start(cam_obj_t *cam, int frame_pos)
124124
} else {
125125
I2S0.in_link.addr = ((uint32_t)&cam->frames[frame_pos].dma[0]) & 0xfffff;
126126
}
127-
127+
128128
I2S0.in_link.start = 1;
129129
I2S0.conf.rx_start = 1;
130130
return true;
@@ -304,8 +304,8 @@ static bool ll_cam_calc_rgb_dma(cam_obj_t *cam){
304304
}
305305
}
306306

307-
ESP_LOGI(TAG, "node_size: %4u, nodes_per_line: %u, lines_per_node: %u",
308-
node_size * cam->dma_bytes_per_item, nodes_per_line, lines_per_node);
307+
ESP_LOGI(TAG, "node_size: %4u, nodes_per_line: %u, lines_per_node: %u",
308+
(unsigned) (node_size * cam->dma_bytes_per_item), nodes_per_line, lines_per_node);
309309

310310
cam->dma_node_buffer_size = node_size * cam->dma_bytes_per_item;
311311

@@ -337,9 +337,10 @@ static bool ll_cam_calc_rgb_dma(cam_obj_t *cam){
337337
size_t dma_buffer_max = 2 * dma_half_buffer_max;
338338
size_t dma_buffer_size = dma_buffer_max;
339339
dma_buffer_size =(dma_buffer_max / dma_half_buffer) * dma_half_buffer;
340-
341-
ESP_LOGI(TAG, "dma_half_buffer_min: %5u, dma_half_buffer: %5u, lines_per_half_buffer: %2u, dma_buffer_size: %5u",
342-
dma_half_buffer_min * cam->dma_bytes_per_item, dma_half_buffer * cam->dma_bytes_per_item, lines_per_half_buffer, dma_buffer_size * cam->dma_bytes_per_item);
340+
341+
ESP_LOGI(TAG, "dma_half_buffer_min: %5u, dma_half_buffer: %5u, lines_per_half_buffer: %2u, dma_buffer_size: %5u",
342+
(unsigned) (dma_half_buffer_min * cam->dma_bytes_per_item), (unsigned) (dma_half_buffer * cam->dma_bytes_per_item),
343+
(unsigned) lines_per_half_buffer, (unsigned) (dma_buffer_size * cam->dma_bytes_per_item));
343344

344345
cam->dma_buffer_size = dma_buffer_size * cam->dma_bytes_per_item;
345346
cam->dma_half_buffer_size = dma_half_buffer * cam->dma_bytes_per_item;

target/esp32s3/ll_cam.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ esp_err_t ll_cam_config(cam_obj_t *cam, const camera_config_t *config)
238238
}
239239

240240
LCD_CAM.cam_ctrl.val = 0;
241-
241+
242242
LCD_CAM.cam_ctrl.cam_clkm_div_b = 0;
243243
LCD_CAM.cam_ctrl.cam_clkm_div_a = 0;
244244
LCD_CAM.cam_ctrl.cam_clkm_div_num = 160000000 / config->xclk_freq_hz;
@@ -278,7 +278,7 @@ esp_err_t ll_cam_config(cam_obj_t *cam, const camera_config_t *config)
278278
LCD_CAM.cam_ctrl1.cam_start = 1;
279279

280280
ret = ll_cam_dma_init(cam);
281-
281+
282282
return ret;
283283
}
284284

@@ -394,8 +394,8 @@ static bool ll_cam_calc_rgb_dma(cam_obj_t *cam){
394394
}
395395
}
396396

397-
ESP_LOGI(TAG, "node_size: %4u, nodes_per_line: %u, lines_per_node: %u",
398-
node_size * cam->dma_bytes_per_item, nodes_per_line, lines_per_node);
397+
ESP_LOGI(TAG, "node_size: %4u, nodes_per_line: %u, lines_per_node: %u",
398+
(unsigned) (node_size * cam->dma_bytes_per_item), (unsigned) nodes_per_line, (unsigned) lines_per_node);
399399

400400
cam->dma_node_buffer_size = node_size * cam->dma_bytes_per_item;
401401

@@ -427,9 +427,10 @@ static bool ll_cam_calc_rgb_dma(cam_obj_t *cam){
427427
if (!cam->psram_mode) {
428428
dma_buffer_size =(dma_buffer_max / dma_half_buffer) * dma_half_buffer;
429429
}
430-
431-
ESP_LOGI(TAG, "dma_half_buffer_min: %5u, dma_half_buffer: %5u, lines_per_half_buffer: %2u, dma_buffer_size: %5u",
432-
dma_half_buffer_min * cam->dma_bytes_per_item, dma_half_buffer * cam->dma_bytes_per_item, lines_per_half_buffer, dma_buffer_size * cam->dma_bytes_per_item);
430+
431+
ESP_LOGI(TAG, "dma_half_buffer_min: %5u, dma_half_buffer: %5u, lines_per_half_buffer: %2u, dma_buffer_size: %5u",
432+
(unsigned) (dma_half_buffer_min * cam->dma_bytes_per_item), (unsigned) (dma_half_buffer * cam->dma_bytes_per_item),
433+
(unsigned) lines_per_half_buffer, (unsigned) (dma_buffer_size * cam->dma_bytes_per_item));
433434

434435
cam->dma_buffer_size = dma_buffer_size * cam->dma_bytes_per_item;
435436
cam->dma_half_buffer_size = dma_half_buffer * cam->dma_bytes_per_item;
@@ -438,7 +439,7 @@ static bool ll_cam_calc_rgb_dma(cam_obj_t *cam){
438439
}
439440

440441
bool ll_cam_dma_sizes(cam_obj_t *cam)
441-
{
442+
{
442443
cam->dma_bytes_per_item = 1;
443444
if (cam->jpeg_mode) {
444445
if (cam->psram_mode) {
@@ -473,7 +474,6 @@ size_t IRAM_ATTR ll_cam_memcpy(cam_obj_t *cam, uint8_t *out, const uint8_t *in,
473474
}
474475
return len / 2;
475476
}
476-
477477

478478
// just memcpy
479479
memcpy(out, in, len);
@@ -502,7 +502,7 @@ esp_err_t ll_cam_set_sample_mode(cam_obj_t *cam, pixformat_t pix_format, uint32_
502502
cam->fb_bytes_per_pixel = 2; // frame buffer stores YU/YV/RGB565
503503
break;
504504
}
505-
#else
505+
#else
506506
cam->in_bytes_per_pixel = 2; // for DMA receive
507507
cam->fb_bytes_per_pixel = 2; // frame buffer stores YU/YV/RGB565
508508
#endif

target/private_include/ll_cam.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ typedef struct {
101101
QueueHandle_t frame_buffer_queue;
102102
TaskHandle_t task_handle;
103103
intr_handle_t cam_intr_handle;
104-
104+
105105
uint8_t dma_num;//ESP32-S3
106106
intr_handle_t dma_intr_handle;//ESP32-S3
107107

@@ -120,7 +120,7 @@ typedef struct {
120120
float in_bytes_per_pixel;
121121
float fb_bytes_per_pixel;
122122
camera_conv_mode_t conv_mode;
123-
#else
123+
#else
124124
uint8_t in_bytes_per_pixel;
125125
uint8_t fb_bytes_per_pixel;
126126
#endif
@@ -140,7 +140,7 @@ esp_err_t ll_cam_init_isr(cam_obj_t *cam);
140140
void ll_cam_do_vsync(cam_obj_t *cam);
141141
uint8_t ll_cam_get_dma_align(cam_obj_t *cam);
142142
bool ll_cam_dma_sizes(cam_obj_t *cam);
143-
size_t IRAM_ATTR ll_cam_memcpy(cam_obj_t *cam, uint8_t *out, const uint8_t *in, size_t len);
143+
size_t ll_cam_memcpy(cam_obj_t *cam, uint8_t *out, const uint8_t *in, size_t len);
144144
esp_err_t ll_cam_set_sample_mode(cam_obj_t *cam, pixformat_t pix_format, uint32_t xclk_freq_hz, uint16_t sensor_pid);
145145

146146
// implemented in cam_hal

0 commit comments

Comments
 (0)