soc: descriptive part occupy whole component

This commit is contained in:
Renz Bagaporo
2020-09-25 13:57:52 +08:00
parent 988be69466
commit 79887fdc6c
442 changed files with 773 additions and 168 deletions

View File

@@ -27,9 +27,8 @@ INCLUDE_DIRS := \
esp_system/include \
xtensa/include \
xtensa/esp32/include \
soc/soc/esp32/include \
soc/esp32/include \
soc/include \
soc/soc/include \
esp32/include \
esp_common/include \
bootloader_support/include \

View File

@@ -2,7 +2,7 @@ COMPONENTS_DIR=../..
COMPILER_ICLUDE_DIR=$(shell echo `which xtensa-esp32-elf-gcc | xargs dirname | xargs dirname`/xtensa-esp32-elf)
CFLAGS=-std=gnu99 -Og -ggdb -ffunction-sections -fdata-sections -nostdlib -Wall -Werror=all -Wno-int-to-pointer-cast -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-macro-redefined -Wno-constant-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-typedef-redefinition -Wno-incompatible-pointer-types -Wextra \
-Wno-unused-parameter -Wno-sign-compare -Wno-address -Wno-unused-variable -DESP_PLATFORM -D IDF_VER=\"v3.1\" -MMD -MP -DWITH_POSIX -DLWIP_NO_CTYPE_H=1
INC_DIRS=-I . -I ./build/config -I $(COMPONENTS_DIR)/newlib/platform_include -I $(COMPONENTS_DIR)/newlib/include -I $(COMPONENTS_DIR)/driver/include -I $(COMPONENTS_DIR)/esp32/include -I $(COMPONENTS_DIR)/ethernet/include -I $(COMPONENTS_DIR)/freertos/include -I $(COMPONENTS_DIR)/heap/include -I $(COMPONENTS_DIR)/lwip/lwip/src/include -I $(COMPONENTS_DIR)/lwip/include/apps -I $(COMPONENTS_DIR)/lwip/lwip/src/include/netif -I $(COMPONENTS_DIR)/lwip/lwip/src/include/posix -I $(COMPONENTS_DIR)/lwip/port/esp32/include -I $(COMPONENTS_DIR)/lwip/lwip/src/include/posix -I $(COMPONENTS_DIR)/lwip/include/apps/ping -I $(COMPONENTS_DIR)/lwip/include/apps/sntp -I $(COMPONENTS_DIR)/soc/esp32/include -I $(COMPONENTS_DIR)/soc/include -I $(COMPONENTS_DIR)/tcpip_adapter/include -I $(COMPONENTS_DIR)/esp_rom/include -I $(COMPONENTS_DIR)/esp_common/include -I $(COMPONENTS_DIR)/xtensa/include -I $(COMPONENTS_DIR)/xtensa/esp32/include -I $(COMPONENTS_DIR)/esp_wifi/include -I $(COMPONENTS_DIR)/esp_event/include -I $(COMPONENTS_DIR)/freertos/xtensa/include -I $(COMPONENTS_DIR)/esp_system/include -I $(COMPONENTS_DIR)/esp_timer/include -I $(COMPONENTS_DIR)/soc/include -I $(COMPONENTS_DIR)/soc/soc/include -I $(COMPONENTS_DIR)/soc/src/esp32/include -I $(COMPONENTS_DIR)/soc/soc/esp32/include -I $(COMPONENTS_DIR)/esp_netif/include -I $(COMPONENTS_DIR)/esp_eth/include -I $(COMPONENTS_DIR)/esp_netif/lwip -I $(COMPONENTS_DIR)/hal/include -I $(COMPONENTS_DIR)/hal/esp32/include -I $(COMPILER_ICLUDE_DIR)/include
INC_DIRS=-I . -I ./build/config -I $(COMPONENTS_DIR)/newlib/platform_include -I $(COMPONENTS_DIR)/newlib/include -I $(COMPONENTS_DIR)/driver/include -I $(COMPONENTS_DIR)/esp32/include -I $(COMPONENTS_DIR)/ethernet/include -I $(COMPONENTS_DIR)/freertos/include -I $(COMPONENTS_DIR)/heap/include -I $(COMPONENTS_DIR)/lwip/lwip/src/include -I $(COMPONENTS_DIR)/lwip/include/apps -I $(COMPONENTS_DIR)/lwip/lwip/src/include/netif -I $(COMPONENTS_DIR)/lwip/lwip/src/include/posix -I $(COMPONENTS_DIR)/lwip/port/esp32/include -I $(COMPONENTS_DIR)/lwip/lwip/src/include/posix -I $(COMPONENTS_DIR)/lwip/include/apps/ping -I $(COMPONENTS_DIR)/lwip/include/apps/sntp -I $(COMPONENTS_DIR)/soc/esp32/include -I $(COMPONENTS_DIR)/soc/include -I $(COMPONENTS_DIR)/tcpip_adapter/include -I $(COMPONENTS_DIR)/esp_rom/include -I $(COMPONENTS_DIR)/esp_common/include -I $(COMPONENTS_DIR)/xtensa/include -I $(COMPONENTS_DIR)/xtensa/esp32/include -I $(COMPONENTS_DIR)/esp_wifi/include -I $(COMPONENTS_DIR)/esp_event/include -I $(COMPONENTS_DIR)/freertos/xtensa/include -I $(COMPONENTS_DIR)/esp_system/include -I $(COMPONENTS_DIR)/esp_timer/include -I $(COMPONENTS_DIR)/soc/include -I $(COMPONENTS_DIR)/soc/include -I $(COMPONENTS_DIR)/soc/src/esp32/include -I $(COMPONENTS_DIR)/soc/esp32/include -I $(COMPONENTS_DIR)/esp_netif/include -I $(COMPONENTS_DIR)/esp_eth/include -I $(COMPONENTS_DIR)/esp_netif/lwip -I $(COMPONENTS_DIR)/hal/include -I $(COMPONENTS_DIR)/hal/esp32/include -I $(COMPILER_ICLUDE_DIR)/include
TEST_NAME=test
FUZZ=afl-fuzz
GEN_CFG=generate_config

View File

@@ -28,8 +28,8 @@ CFLAGS=-g -Wno-unused-value -Wno-missing-declarations -Wno-pointer-bool-conversi
-I$(COMPONENTS_DIR)/lwip/port/esp32/include \
-I$(COMPONENTS_DIR)/lwip/lwip/src/include/lwip/apps \
-I$(COMPONENTS_DIR)/soc/include \
-I$(COMPONENTS_DIR)/soc/soc/include \
-I$(COMPONENTS_DIR)/soc/soc/esp32/include \
-I$(COMPONENTS_DIR)/soc/include \
-I$(COMPONENTS_DIR)/soc/esp32/include \
-I$(COMPONENTS_DIR)/soc/src/esp32/include \
-I$(COMPONENTS_DIR)/tcpip_adapter/include \
-I$(COMPONENTS_DIR)/xtensa/include \

View File

@@ -1,13 +1,10 @@
idf_build_get_property(target IDF_TARGET)
idf_component_register(SRCS "src/lldesc.c"
"src/soc_include_legacy_warn.c"
"src/memory_layout_utils.c"
idf_component_register(SRCS "lldesc.c"
"soc_include_legacy_warn.c"
"memory_layout_utils.c"
INCLUDE_DIRS include
PRIV_REQUIRES hal # [refactor-todo] soc dependency on hal for rtc sources
LDFRAGMENTS linker.lf)
add_subdirectory(soc)
add_subdirectory(src/${target})
target_link_libraries(${COMPONENT_LIB} PUBLIC "soc_${target}")
add_subdirectory(${target})

View File

@@ -1,33 +1,10 @@
## `soc` ##
The `soc` component provides provides hardware description and hardware support functionality for targets supported by ESP-IDF. This is reflected in the component's subdirectories:
- `soc/include` - abstraction
- `soc/soc` - description
- `soc/src` - implementation
#### `soc/include` ####
`soc/include` contains header files which provide a hardware-agnostic interface to the SoC. The interface consists of
function declarations and abstracted types that other, higher level components can make use of in order to have code portable to
all targets ESP-IDF supports.
The `soc` subdirectory contains other useful interface for SoC-level operations or concepts, such as the memory layout, spinlocks, etc.
#### `soc/soc` ####
The `soc/soc` subdirectory contains description of the underlying hardware:
The `soc` component provides hardware description for targets supported by ESP-IDF.
- `xxx_reg.h` - defines registers related to the hardware
- `xxx_struct.h` - hardware description in C `struct`
- `xxx_channel.h` - definitions for hardware with multiple channels
- `xxx_caps.h` - features/capabilities of the hardware
- `xxx_pins.h` - pin definitions
- `xxx_periph.h/*.c` - includes all headers related to a peripheral; declaration and definition of IO mapping for that hardware
Since the hardware description is target-specific, there are subdirectories for each target containing copies of the files above.
Furthermore, the files in this directory should be standalone, i.e. should not include files from outside directories.
#### `soc/src` ####
Provides the interface about the memory, I2C, and Real_Time Clock functions.
- `xxx_periph.h/*.c` - includes all headers related to a peripheral; declaration and definition of IO mapping for that hardware

View File

@@ -1,14 +1,4 @@
SOC_NAME := $(IDF_TARGET)
COMPONENT_SRCDIRS := src
COMPONENT_ADD_INCLUDEDIRS :=
# Since there can be chip-specific HAL headers which can include the common
# HAL header via include_next, process the build scripts here first so that
# include directories appear first in the compile command.
-include $(COMPONENT_PATH)/src/$(SOC_NAME)/component.mk
COMPONENT_ADD_INCLUDEDIRS += include
-include $(COMPONENT_PATH)/soc/component.mk
COMPONENT_SRCDIRS := . $(IDF_TARGET)
COMPONENT_ADD_INCLUDEDIRS := include $(IDF_TARGET) $(IDF_TARGET)/include
COMPONENT_ADD_LDFRAGMENTS += linker.lf

View File

@@ -1,13 +1,27 @@
set(srcs
"adc_periph.c"
"dac_periph.c"
"gpio_periph.c"
"i2c_periph.c"
"i2s_periph.c"
"interrupts.c"
"pcnt_periph.c"
"ledc_periph.c"
"rtc_clk.c"
"rtc_clk_init.c"
"rtc_init.c"
"rtc_io_periph.c"
"rtc_periph.c"
"rtc_pm.c"
"rtc_sleep.c"
"rtc_time.c"
"rtc_wdt.c"
"sdio_slave_periph.c"
"sdmmc_periph.c"
"soc_memory_layout.c"
)
"spi_periph.c"
"touch_sensor_periph.c"
"uart_periph.c")
add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}")

Some files were not shown because too many files have changed in this diff Show More