Skip to content

Commit fac9509

Browse files
Fix/pedantic build (#529)
* Fix: Make esp32-camera function prototypes strict This is required for pedantic builds with -Wstrict-prototypes flag * ci: Enable pedantic example build
1 parent 2e6a36d commit fac9509

File tree

7 files changed

+47
-88
lines changed

7 files changed

+47
-88
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6,92 +6,49 @@ on:
66
pull_request:
77

88
jobs:
9-
build-master:
10-
runs-on: ubuntu-latest
11-
strategy:
12-
matrix:
13-
idf_target: ["esp32", "esp32s2", "esp32s3"]
14-
steps:
15-
- name: Checkout repo
16-
uses: actions/checkout@v2
17-
with:
18-
submodules: 'recursive'
19-
- name: esp-idf build
20-
uses: espressif/esp-idf-ci-action@main
21-
with:
22-
target: ${{ matrix.idf_target }}
23-
path: 'examples'
24-
25-
build-release-v5_0:
9+
build-examples:
2610
name: Build for ${{ matrix.idf_target }} on ${{ matrix.idf_ver }}
2711
runs-on: ubuntu-latest
2812
strategy:
2913
matrix:
30-
idf_ver: ["release-v5.0"]
31-
idf_target: ["esp32", "esp32s2", "esp32s3"]
14+
idf_ver: ["release-v4.1", "release-v4.2", "release-v4.3"]
15+
idf_target: ["esp32", "esp32s2"]
16+
exclude:
17+
- idf_ver: "release-v4.1"
18+
idf_target: esp32s2 # ESP32S2 support started with version 4.2
19+
container: espressif/idf:${{ matrix.idf_ver }}
3220
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-
44-
build-release-v4_4:
21+
- uses: actions/checkout@v1
22+
with:
23+
submodules: 'true'
24+
- name: esp-idf build
25+
env:
26+
IDF_TARGET: ${{ matrix.idf_target }}
27+
shell: bash
28+
working-directory: examples
29+
run: |
30+
. ${IDF_PATH}/export.sh
31+
idf.py build
32+
build-examples-pedantic:
4533
name: Build for ${{ matrix.idf_target }} on ${{ matrix.idf_ver }}
4634
runs-on: ubuntu-latest
4735
strategy:
4836
matrix:
49-
idf_ver: ["v4.4"]
37+
idf_ver: ["release-v4.4", "release-v5.0", "release-v5.1", "latest"]
5038
idf_target: ["esp32", "esp32s2", "esp32s3"]
39+
container: espressif/idf:${{ matrix.idf_ver }}
5140
steps:
52-
- name: Checkout repo
53-
uses: actions/checkout@v2
54-
with:
55-
submodules: 'recursive'
56-
- name: esp-idf build
57-
uses: espressif/esp-idf-ci-action@main
58-
with:
59-
esp_idf_version: ${{ matrix.idf_ver }}
60-
target: ${{ matrix.idf_target }}
61-
path: 'examples'
62-
63-
build-release-v4_1:
64-
runs-on: ubuntu-latest
65-
steps:
66-
- name: Checkout repo
67-
uses: actions/checkout@v2
68-
with:
69-
submodules: 'recursive'
70-
- name: esp-idf build
71-
uses: espressif/esp-idf-ci-action@release-v4.1
72-
with:
73-
path: 'examples'
74-
75-
build-release-v4_2:
76-
runs-on: ubuntu-latest
77-
steps:
78-
- name: Checkout repo
79-
uses: actions/checkout@v2
80-
with:
81-
submodules: 'recursive'
82-
- name: esp-idf build
83-
uses: espressif/esp-idf-ci-action@release-v4.2
84-
with:
85-
path: 'examples'
86-
87-
build-release-v4_3:
88-
runs-on: ubuntu-latest
89-
steps:
90-
- name: Checkout repo
91-
uses: actions/checkout@v2
92-
with:
93-
submodules: 'recursive'
94-
- name: esp-idf build
95-
uses: espressif/esp-idf-ci-action@release-v4.3
96-
with:
97-
path: 'examples'
41+
- uses: actions/checkout@v1
42+
with:
43+
submodules: 'true'
44+
- name: esp-idf build
45+
env:
46+
IDF_TARGET: ${{ matrix.idf_target }}
47+
shell: bash
48+
working-directory: examples
49+
run: |
50+
. ${IDF_PATH}/export.sh
51+
export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
52+
export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes"
53+
export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}"
54+
idf.py build

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.vscode
33
**/build
44
**/sdkconfig
5-
**/sdkconfig.old
5+
**/sdkconfig.old
6+
**/dependencies.lock

driver/include/esp_camera.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,14 @@ esp_err_t esp_camera_init(const camera_config_t* config);
194194
* - ESP_OK on success
195195
* - ESP_ERR_INVALID_STATE if the driver hasn't been initialized yet
196196
*/
197-
esp_err_t esp_camera_deinit();
197+
esp_err_t esp_camera_deinit(void);
198198

199199
/**
200200
* @brief Obtain pointer to a frame buffer.
201201
*
202202
* @return pointer to the frame buffer
203203
*/
204-
camera_fb_t* esp_camera_fb_get();
204+
camera_fb_t* esp_camera_fb_get(void);
205205

206206
/**
207207
* @brief Return the frame buffer to be reused again.
@@ -215,7 +215,7 @@ void esp_camera_fb_return(camera_fb_t * fb);
215215
*
216216
* @return pointer to the sensor
217217
*/
218-
sensor_t * esp_camera_sensor_get();
218+
sensor_t * esp_camera_sensor_get(void);
219219

220220
/**
221221
* @brief Save camera settings to non-volatile-storage (NVS)

driver/private_include/sccb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
int SCCB_Init(int pin_sda, int pin_scl);
1313
int SCCB_Use_Port(int sccb_i2c_port);
1414
int SCCB_Deinit(void);
15-
uint8_t SCCB_Probe();
15+
uint8_t SCCB_Probe(void);
1616
uint8_t SCCB_Read(uint8_t slv_addr, uint8_t reg);
1717
int SCCB_Write(uint8_t slv_addr, uint8_t reg, uint8_t data);
1818
uint8_t SCCB_Read16(uint8_t slv_addr, uint16_t reg);

driver/private_include/xclk.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#pragma once
22

33
#include "esp_system.h"
4+
#include "esp_camera.h"
45

56
esp_err_t xclk_timer_conf(int ledc_timer, int xclk_freq_hz);
67

7-
esp_err_t camera_enable_out_clock();
8+
esp_err_t camera_enable_out_clock(const camera_config_t *config);
89

9-
void camera_disable_out_clock();
10+
void camera_disable_out_clock(void);

examples/main/take_picture.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static camera_config_t camera_config = {
127127
.grab_mode = CAMERA_GRAB_WHEN_EMPTY,
128128
};
129129

130-
static esp_err_t init_camera()
130+
static esp_err_t init_camera(void)
131131
{
132132
//initialize the camera
133133
esp_err_t err = esp_camera_init(&camera_config);
@@ -140,7 +140,7 @@ static esp_err_t init_camera()
140140
return ESP_OK;
141141
}
142142

143-
void app_main()
143+
void app_main(void)
144144
{
145145
if(ESP_OK != init_camera()) {
146146
return;

target/xclk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ esp_err_t xclk_timer_conf(int ledc_timer, int xclk_freq_hz)
3434
return err;
3535
}
3636

37-
esp_err_t camera_enable_out_clock(camera_config_t* config)
37+
esp_err_t camera_enable_out_clock(const camera_config_t* config)
3838
{
3939
esp_err_t err = xclk_timer_conf(config->ledc_timer, config->xclk_freq_hz);
4040
if (err != ESP_OK) {

0 commit comments

Comments
 (0)