Skip to content

Commit

Permalink
soc: Move revision MAX/MIN static assert to esp_hw_support
Browse files Browse the repository at this point in the history
Previously, "soc/chip_revision.h" contained a static assert to check that the
CONFIG_ESP_REV_MIN_FULL <= CONFIG_ESP_REV_MAX_FULL. There are two issues with
this assert:

- Contained in a header file, so it is only compiled if the "chip_revision.h"
is included somewhere
- CONFIG_ESP_REV_MIN_FULL and CONFIG_ESP_REV_MAX_FULL are defined in
"esp_hw_support", which is a G0 component. This creates a reverse dependency
of G0 on G1.

This commit moves the static assert "revision.c" in "esp_hw_support".
  • Loading branch information
Dazza0 committed Jul 13, 2023
1 parent 7d386f6 commit 8450f31
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions components/esp_hw_support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if(NOT BOOTLOADER_BUILD)
"intr_alloc.c"
"mac_addr.c"
"periph_ctrl.c"
"revision.c"
"rtc_module.c"
"sleep_modes.c"
"sleep_gpio.c"
Expand Down
16 changes: 16 additions & 0 deletions components/esp_hw_support/revision.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "sdkconfig.h"
#include "esp_assert.h"

/*
Source used to store ESP chip revision and ESP-IDF minimum supported revision in the future.
Currently only used to hold static assert to check that the configured minimum and maximum supported chip revisions of
ESP-IDF are valid.
*/

ESP_STATIC_ASSERT(CONFIG_ESP_REV_MIN_FULL <= CONFIG_ESP_REV_MAX_FULL);
7 changes: 1 addition & 6 deletions components/soc/include/soc/chip_revision.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include "esp_assert.h"
#include "sdkconfig.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -34,8 +31,6 @@ extern "C" {
#define ESP_CHIP_REV_ABOVE(rev, min_rev) ((min_rev) <= (rev))
#define ESP_CHIP_REV_MAJOR_AND_ABOVE(rev, min_rev) (((rev) / 100 == (min_rev) / 100) && ((rev) >= (min_rev)))

ESP_STATIC_ASSERT(CONFIG_ESP_REV_MIN_FULL <= CONFIG_ESP_REV_MAX_FULL);

#ifdef __cplusplus
}
#endif

0 comments on commit 8450f31

Please sign in to comment.