mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 12:35:28 +00:00
Merge branch 'master' into feature/menuconfig_cpu_frequency_option
* master: (57 commits) components/lwip: fix grammar components/lwip: make SO_REUSE configurable via menuconfig bootloader: remove trailing newlines from log messages components/freertos: override per-task __cleanup handler to close stdin, stdout, stderr components/esp32: move peripheral symbols to separate ld script components/log: regroup macros for better readability gitlab-ci: allow running tests for branches, triggered via API components/log: fix timestamp calculation components/log: set default runtime log level to ESP_LOG_VERBOSE components/log: fix error when using ESP_LOGx from C++ code components/log: fix bugs, add options to override log level for files, components, and bootloader fix ledc and spi typo remove prefix and postfix Enable SO_REUSEADDR in LWIP freertos: fix memory debug macro issue Define configENABLE_MEMORY_DEBUG according to CONFIG_ENABLE_MEMORY_DEBUG peripheral structure headers: move volatile keyword from members to typedef Adding -fstrict-volatile-bitfields to the CFLAGS/CXXFLAGS. Without this, gcc tries to access bitfields using the smallest possible methods (eg l8i to grab an 8-bit field from a 32-bit). Our hardware does not like that. This flag tells gcc that if a bitfield is volatile, it should always use the type the field is defined at (uint32_t in our case) to size its access to the field. This fixes accessing the hardware through the xxx_struct.h headers. add peripheral module struct headers build system docs: Add note about no spaces in component names Docs: Add note about unusual submodule messages when cloning on Windows ... # Conflicts: # components/esp32/cpu_start.c # components/esp32/include/soc/cpu.h
This commit is contained in:
@@ -33,6 +33,41 @@ static inline bool cpu_in_interrupt_context(void)
|
||||
return (ps & PS_UM) == 0;
|
||||
}
|
||||
|
||||
/* Functions to set page attributes for Region Protection option in the CPU.
|
||||
* See Xtensa ISA Reference manual for explanation of arguments (section 4.6.3.2).
|
||||
*/
|
||||
|
||||
static inline void cpu_write_dtlb(uint32_t vpn, unsigned attr)
|
||||
{
|
||||
asm volatile ("wdtlb %1, %0; dsync\n" :: "r" (vpn), "r" (attr));
|
||||
}
|
||||
|
||||
|
||||
static inline void cpu_write_itlb(unsigned vpn, unsigned attr)
|
||||
{
|
||||
asm volatile ("witlb %1, %0; isync\n" :: "r" (vpn), "r" (attr));
|
||||
}
|
||||
|
||||
/* Make page 0 access raise an exception.
|
||||
* Also protect some other unused pages so we can catch weirdness.
|
||||
* Useful attribute values:
|
||||
* 0 — cached, RW
|
||||
* 2 — bypass cache, RWX (default value after CPU reset)
|
||||
* 15 — no access, raise exception
|
||||
*/
|
||||
|
||||
static inline void cpu_configure_region_protection()
|
||||
{
|
||||
const uint32_t pages_to_protect[] = {0x00000000, 0x80000000, 0xa0000000, 0xc0000000, 0xe0000000};
|
||||
for (int i = 0; i < sizeof(pages_to_protect)/sizeof(pages_to_protect[0]); ++i) {
|
||||
cpu_write_dtlb(pages_to_protect[i], 0xf);
|
||||
cpu_write_itlb(pages_to_protect[i], 0xf);
|
||||
}
|
||||
cpu_write_dtlb(0x20000000, 0);
|
||||
cpu_write_itlb(0x20000000, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @brief Set CPU frequency to the value defined in menuconfig
|
||||
|
Reference in New Issue
Block a user