requirement from github(https://github.com/espressif/esp-idf/issues/805): to provide the position in the buffer of the pattern detected.
requirement from AT application: in AT app, when no hardware flow control is enabled, in some situation the rx buffer might be full, and the terminator “+++” might be lost, we can use pattern detect interrupt to avoid missing the terminator. When pattern detect interrupt happens, it will not send a data event at the same time.
1. Add API to get position of detected pattern in rx buffer
2. Modify UART event example
3. Add comments for uart_flush, add alias API uart_flush_input to clear the rx buffer
4. Modify the way rx_buffered_len is calculated
Changes related to DFS have broken compilation of sysview code in 1 core
mode. This change fixes this, and moves choice of the timer used for
timestamp into Kconfig. CCOUNT timer is only available as an option if
1 core mode is used. esp_timer is added as a new option, and is the
only available option if DFS is enabled.
1. "lwip_socket" should close by "lwip_close_r" other than "lwip_close"
2. for generally compatible, fix all lwip interface to normally socket interface
3. call vTaskDelete when new socket failed in case of task crash
close #https://github.com/espressif/esp32-at/issues/58
1. remove the feature mask parameter from AVRC connection state event, as the AVCTP connection can be initiated by remote device before service discovery to remote device is performed. \
In this case, AVRCP connection state event may not be reported after connection initated by remote device is established.
2. remove ESP_AVRC_CT_MAX_EVT
3. add more documentations to AVRC APIs
When INT WDT fires, panicHandler is invoked. In OCD mode, panicHandler
sets a breakpoint on the PC from the exception frame and returns.
However in case of INT WDT, interrupt flag is still set in TIMERG1
peripheral, which causes INT WDT to trigger again. This causes an
endless stream of "Core 0 panic'ed (Interrupt wdt timeout on CPU1)"
messages. OpenOCD also gets terribly confused at this point.
Disable watchdogs when exiting panic handler in OCD mode.
Clear TIMERG1 WDT interrupt flag to prevent re-entry into panic handler.
RTC_FAST_CLK_FREQ_APPROX is defined as 8500000, so 0.5MHz part was lost
when dividing by MHZ. Since cal_val is 64-bit the parens can be removed.
With 40MHz XTAL for a nominal ESP32 chip, this fixes estimated XTAL
frequency from 38 to 40MHz.
LOG_LOCAL_LEVEL is now used in a construct like:
#if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO)
Make sure that LOG_LOCAL_LEVEL is defined, and don't use a type cast in
its definition, because preprocessor can not parse that.
1. ESP32 is found to suffer from AES encryption start/resume failure with specific device. Therefore temporarily disable BR/EDR Secure Connections for a workaround
2. BR/EDR Secure Connections is a feature for BT Classic introduced in Bluetooth 4.1. This change disables the setting of Secure Connections(Host Supported), and will result in the use of legacy authentication instead of secure authentication, and E0 encryption(legacy) instead of AES-CCM encryption. BLE security procedures are not affected.
Bugfix to prevent a self deleting no affinity task's memory from being freed by the
idle task of the other core before the self deleting no affinity task is able to context
switch out. prvCheckTasksWaitingTermination now checks if the task is still on
pxCurrentTCB before freeing task memory.
When tcp write/connect is running, close socket request will abort
it and continue to delete netconn and close tcp. Do not immediately
return after aborting tcp write/connect. Otherwise, tcp close
requeset will block and tcp write/connect will crash.
1. optimiz the ble stop adv callback function.
2. added the osi_mutex_unlock in the bta_gattc_wait4_service_change_ccc_cback function when the p_timer_param == NULL || p_conn == NULL.
1. fix the bug. Modify the condition that esp_bt_controller_mem_release() shoud be only called before esp_bt_controller_init() or after esp_bt_controller_deinit()
2. modify the example to use esp_bt_controller_mem_release()
libc time function now rely on esp_timer_get_time as the source of
high-resolution time, rather than FRC1 timer. Internally, on the ESP32
esp_timer implementation uses FRC2 timer.
- Change help text and labels in Kconfig to use "high-resolution timer"
instead of FRC1. Keep existing Kconfig option name to be backwards
compatible.
- Change references to "FRC1" in the source code to "FRC".
Replace explicit masks and shifts with bit fields when working with FATFS date and time representations. Also zero-initialize remaining members of struct tm.
Fixes https://github.com/espressif/esp-idf/issues/1369.
A couple of typos referencing tx_ring_buf when rx_ring_buf, slv_tx_mux
instead of slv_rx_mux.
Also, I2C_ENTER_CRITICAL()/I2C_EXIT_CRITICAL() usage was not consistent.
Only some of the _set_ functions had them. Most of the _get_ function
had them? It is my understanding that they should be wrapped around
writes, not reads? (I think we still need the lock for reading pairs of consistent values)
Also, the ticks_to_wait timeout handling in i2c_master_cmd_begin() would
not handle integer rollover correctly.
Merges https://github.com/espressif/esp-idf/pull/1180
Previously SDSPI host driver would rely on retry count when waiting for
the card to read or write data. This caused different timeout times
depending on CPU frequency and card clock frequency. In practice, card
performance does not depend on these two factors.
This change uses timeout_ms field of sdmmc_command_t introduced
previously for SDMMC host.
Fixes https://esp32.com/viewtopic.php?f=2&t=3440&p=16037 and similar
issues related to SDSPI timeouts.
FATFS does not support f_stat call for drive root. When handling stat
for drive root, don't call f_stat and just return struct st with S_IFDIR
flag set.
Closes#984
A function to change "in IRAM" status for an existing interrupt handle, without going through free/allocate of the interrupt.
mOS HW timer implementation requires this to make HW timers safe to re-set from an IRAM ISR.
This is a wrapper API for creating a Ring Buffer, which ensures that
the ringbuffer can hold the given number of items, each item being of the
same given length.
Signed-off-by: Piyush Shah <piyush@espressif.com>
Useful to check if the next item to receive is wrapped or not.
This is valid only if the ring buffer is initialised with type
RINGBUF_TYPE_ALLOWSPLIT.
This is as per the feature request here:
https://github.com/espressif/esp-idf/issues/806
Signed-off-by: Piyush Shah <piyush@espressif.com>
The earlier available API (xRingbufferGetMaxItemSize())just gives
a static max entry value possible for given ring buffer.
There was a feature request for an API which could provide
a real time available buffer size. See below:
https://github.com/espressif/esp-idf/issues/806
Signed-off-by: Piyush Shah <piyush@espressif.com>
- Use `code` tags instead of a mix of `<pre></pre>` and
`@verbatim .. @endverbatim`
- Remove manually added function prototypes from comment blocks
- Remove of grouping (`\defgroup`) — some extra work is needed
to make groups compatible with the way we auto-generate API
reference from Doxygen XML files. It's pretty easy to add the
grouping directives back if/when we implement support for
Doxygen groups in the later stages of documentation build
process.
- Hide private APIs under `@cond .. @endcond`
- Convert some comments into Doxygen-compatible ones
- Fix various documentation issues: missing documentation for
some parameters, mismatch between parameter names in comment
block and in function prototype.
- Add doxygen comments for functions which didn't have them
(thread local storage).
- Add [out] param tags where necessary
- Redefine `xTaskCreate` and `xTaskCreateStatic` as inline
functions instead of macros.
When compiling
> const ulp_insn_t program[] = {
> I_DELAY(1)
> };
with the xtensa-esp32-elf-g++ compiler i always got the error:
> sorry, unimplemented: non-trivial designated initializers not supported
>
> };
This was due to the different order in the macro and the struct. The struct has another order of the fields (opcode, unused, cycles) vs (cycles, unused, opcode):
> struct {
> uint32_t cycles : 16; /*!< Number of cycles to sleep */
> uint32_t unused : 12; /*!< Unused */
> uint32_t opcode : 4; /*!< Opcode (OPCODE_DELAY) */
> } delay; /*!< Format of DELAY instruction */
After updating the order in the macro it is possible to compile with the g++ compiler.
Merges https://github.com/espressif/esp-idf/pull/1310
This commit backports vTaskDelete() behavior from FreeRTOS v9.0.0 which
allows for the immediate freeing of task memory if the task being deleted
is not currently running and not pinned to the other core. This commit also
fixes a bug in prvCheckTasksWaitingTermination which prevented the
Idle Task from cleaning up all tasks awaiting deletion. Each iteration of the Idle
Task should traverse the xTasksWaitingTermination list and clean up all tasks
not pinned to the other core. The previous implementation would cause
prvCheckTasksWaitingTermination to return when encountering a task
pinned to the other core whilst traversing the xTasksWaitingTermination list.
The test case for vTaskDelete() has been updated to test for the bugfix and
backported deletion behavior.
* Change snprintf for strlcat does not complain w/gcc7.2.0 and it is safer, thanks @projectgus
* Use proper quotes for character literals
Merges https://github.com/espressif/esp-idf/pull/1163
1. Add a hide API for station to receive and process probe request
frame.
2. Fix an issue that wifi/bt coexistence crashes in PSRAM version.
3. Fix an issue that the API for clearing vendor ie can not work.
4. Fix an issue that wifi stop and reboot leads watchdog.
Reported from github:
https://github.com/espressif/esp-idf/issues/1312https://github.com/espressif/esp-idf/issues/1193
Issues:
1. We used to use event group in the driver, which would cause:
a. longer operation time since the event group are based on FreeRTOS timer.
b. Operation fails if the timer queue is not long enough.
2. There might be some issue with event group, we will still try to provide a small test code in other branch.
modification:
1. use queue instead of event-bit for internal commands
2. use queue overwrite for cmd_done event
Timer callback can delete the timer. If CONFIG_ESP_TIMER_PROFILING was
enabled, this caused an access to invalid (freed) memory.
This fix adds a pointer to track the timer while executing the callback.
This is needed so that we can check if callback deletes the timer,
in which case we won't try updating profiling counters for this timer
after the callback is done.
This commit backports the following features from FreeRTOS v9.0.0
- uxSemaphoreGetCount()
- vTimerSetTimerId(), xTimerGetPeriod(), xTimerGetExpiryTime()
- xTimerCreateStatic()
- xEventGroupCreateStatic()
- uxSemaphoreGetCount()
Functions backported previously
- xTaskCreateStatic()
- xQueueCreateStatic()
- xSemaphoreCreateBinaryStatic(), xSemaphoreCreateCountingStatic()
- xSemaphoreCreateMutexStatic(), xSemaphoreCreateRecursiveMutexStatic()
- pcQueueGetName()
- vTaskSetThreadLocalStoragePointer()
- pvTaskGetThreadLocalStoragePointer()
Unit tests were also written for the functions above (except for pcQueueGetName
which is tested in a separate Queue Registry MR). The original tlsp and del cb test case
was deleted and integrated into the test cases of this MR.
When using CPP and C combination this particular file threw error on linking.
Merges https://github.com/espressif/esp-idf/pull/1249
(Amended to add INC_FREERTOS_H guard, comment on #endif)
1. Usage of this module required applications to include additional
files. What files to include is not very intuitive. Instead, it is
better for the header file itself to include other files as required.
2. Even though it may seem logical, it is better to explicitly mention
that an item needs to be "Returned" after a Receive
Signed-off-by: Piyush Shah <piyush@espressif.com>
It was observed that if the ring buffer size provided by application
is not a multiple of 4, some checks were failing (as read_ptr and write_ptr
could shoot beyond the ring buffer boundary), thereby causing asserts.
Simply wrapping around the pointers for such cases fixes the issue.
Moreover, because of the logic for maintaining 4-byte boundary,
it was also possible that a wrap-around occurred for some data,
even when the actual size remaining was sufficient for it.
Eg. Buffer available: 34, data size: 34, 4-byte aligned size: 36
Since the logic compares against 36, it writes 34 bytes and does a
wraparound. But since all 34 bytes are already written, there is
nothing to write after wrapping. It is better to just re-set the
write pointer to the dtart of ring buffer in such cases.
Tested send/receive for various arbitrary sizes of data and for
arbitrary sizes of ring buffer.
Alternative Solutions:
1) Allow only sizes which are multiples of 4, and return error otherwise.
Appropriate code and documentation change would be required
2) Allow arbitrary sizes, but internally add upto 3 bytes to make
the total size a multiple of 4
Signed-off-by: Piyush Shah <piyush@espressif.com>
disabled
The misssing stubs get pulled in from the toolchain's libstdc++ also
causing to pull in defined stubs. This results in redefinition of
symbols. Fixing it by simply adding the missing stubs when exceptions
are disabled.
Signed-off-by: Amey Inamdar <amey.inamdar@gmail.com>
This defines the OpenSSL X509_CHECK_FLAG_...s and the set/clear
accessors. Since none of them are supported, the set / clear
accessor currently always does nothing and returns error.
This call is often part of the generic openssl user code to
set up certificate verification. This patch allows it to
compile for ESP32 and decide at runtime what to do about
unsupported flags.
Merges https://github.com/espressif/esp-idf/pull/980
This lets the user code set the mbedtls hostname using the standard OpenSSL
X509_VERIFY_PARAM_set1_host() API semantics.
The API takes an X509_VERIFY_PARAM pointer. We use the fact that is
a composed member of the SSL struct to derive the SSL pointer.
The X509_VERIFY_PARAM_set1_host() is unusual in that it can accept a
NUL terminated C string as usual, or a nonterminated pointer + length.
This implementation converts the latter to the former if given, before
using it.
This is enough for user code to get the openssl wrapper to make
mbedtls confirm the CN on the peer cert belongs to the hostname used
to reach it, by doing, eg
X509_VERIFY_PARAM_set1_host(SSL_get0_param(myssl), myhostname, 0);
Merges https://github.com/espressif/esp-idf/pull/980
This adds the standard OpenSSL api to get a pointer to the SSL struct's
X509_VERIFY_PARAM. We need this for the OpenSSL api to set the peer
hostname introduced in the next patch.
Part of https://github.com/espressif/esp-idf/pull/980
These functions were discarded but not provided in ROM.
Generated from commit 8ad0aa7d6 in newlib script repo. Didn't rebuild most of libc/libc_nano,
only appended the missing object files to the existing archives (should save some git churn).
In the queue registry test, start_sem is given twice to let both tasks
start the test. Each task takes start_sem, does some work, gives done_sem,
and goes on to wait for start_sem again.
It may happen that one task can grab start_sem, add queues to the
registry, give done_sem, then grab start_sem again, delete the queues
from the registry, and give done_sem again. At this point, main test
task takes done_sem twice and proceeds to verify that queues have been
added to the registry. But in fact, the first task has already deleted
its queues from the registry, and the second one might not have added
the queues yet. This causes test to fail.
This changes the test to use separate start semaphores for each task,
to avoid the race condition.
1. All the registers of touch sensor 8 and 9 are mismatched except the ‘dac’ field in touch register of RTC IO
2. To swap the index for sensor 8 and 9 in APIs.
This commit makes the configQUEUE_REGISTRY_SIZE and
configGENERATE_RUN_TIME_STATS configurable in menuconfig.
- configQUEUE_REGISTRY_SIZE can now be set in menuconfig.
- The functions vQueueAddToRegistry() and vQueueUnregisterQueue() were made
SMP compatbile
- pcQueueGetName() was backported from FreeRTOS v9.0.0
- Added test case for Queue Registry functions
- configGENERATE_RUN_TIME_STATS can now be enabled in menuconfig. CCOUNT or
esp_timer can be selected as the FreeRTOS run time clock in menuconfig as
well, although CCOUNT will overflow quickly.
- Run time stats collection (in vTaskSwitchContext) and generation (in
uxTaskGetSystemState) have been made SMP compatible. Therefore
vTaskGetRunTimeStats() now displays the run time usage of each task as a
percentage of total runtime of both CPUs
Squash
- Remove ASCII-only configuration, CP437 is used instead
- Add dynamic code page configuration
See components/fatfs/src/00history.txt for FATFS changelog.
Reported from github:
https://github.com/espressif/esp-idf/issues/1219https://github.com/espressif/esp-idf/issues/1202
After providing a simple code to digital team, they confirmed that this is a hardware bug.
Root cause:
The fifo reset signal is incorrectly connected
If we want to reset tx fifo of UART2, we have to set txfifo_rst bit of both UART1 and UART2
If we want to reset rx fifo of UART2, we have to set rxfifo_rst bit of both UART1 and UART2
Workaround:
we don't use fifo rst bit in driver.
Documentation:
Digital team would update TRM and give more explanation about this issue.
1. use esp_timer instead of FreeRTOS timer to implement osi_alarm in bluedroid
2. Remove two APIs: osi_alarm_now() and osi_alarm_time_diff() and modify the hci layer logic that use them
3. Implement osi_alarm_get_remaining_ms()
4. Move the definition of struct alarm_t in source file "alarm.c"
5. Add definition of module error code
To achieve reliable operation with GD flash at 80MHz, need to raise
core voltage.
This causes the following current consumption increase:
At 80MHz: from 29mA to 33mA
At 160MHz: from 41mA to 47mA
Test conditions: 2 cores running code from IRAM, remaining peripherals
clock gated.
Earlier recursive mutex was being used for this but since
SCOMPARE1 is already being saved/restored during context
switch, atomic compare and set can be used for this.
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
Test cases were added for the following functions
- xTaskNotify(), xTaskNotifyGive(), xTaskNotifyFromISR(), vTaskNotifyGiveFromISR(),
- xTaskNotifyWait(), ulTaskNotifyTake()
- vTaskDelayUntil()
The following function was made smp compatible and tested as well
- eTaskGetState()
Old behavior assumes message compressed when any of 2 most significant bits are set,
But in fact Message compressed only when both those bits are set to 1.
Also maximal label length should be 63 bytes.
Renamed the internal rc to __err_rc to avoid clashes with local variables.
This code would not do the expected thing with the original ESP_ERROR_CHECK macro:
esp_err_t my_func(esp_err_t x)
{
assert(x == 23);
}
esp_err_t rc = 23; //some value that is important fo the user
ESP_ERROR_CHECK(my_func(rc));
The macro will expand to:
esp_err_t rc = (my_func(rc));
And the code will assert, as my_func will receive a random value - whatever is in the internal macro rc temp variable. This is due to the C weirdness of allowing this code:
int x = x; //x has a random value.
Pointer tcpip_api_call *m should be converted to pppapi_msg* instead of pppapi_msg_msg*
in pppapi_do_ppp_set_default(), pppapi_do_ppp_free() and so on.
It solve this issue https://github.com/espressif/esp-idf/pull/1028
so there is no need to patch ip4.c because now netif_defauilt is setted correctly.
Also it prevents memory corruption when pppapi_free() is called.
This commit reverts the revert on the new task watchdog API. It also
fixes the following bug which caused the reversion.
- sdkconfig TASK_WDT_TIMEOUT_S has been reverted from the unit of ms back to the
unit of seconds. Fixes bug where projects using the new API without rebuilding sdkconfig
would cause the old default value of 5 to be interpreted in ms.
This commit also adds the following features to the task watchdog
- Updated idle hook registration to be compatible with dual core hooks
- Updated dual core hooks to support deregistration for cpu
- Legacy mode has been removed and esp_task_wdt_feed() is now replaced by
esp_task_wdt_reset(). esp_task_wdt_feed() is deprecated
- Idle hooks to reset are now registered/deregistered when the idle tasks are
added/deleted from the Task Watchdog instead of at Task Watchdog init/deinit
- Updated example
1. V366, fix a problem which initialize current can reach 800mA.
2. V365, fix a problem for pll_cap tracking in Coexist (BT & WIFI)
mode. The problem will make Coexist (BT & WIFI) WIFI AP mode TX
Fail in high temperature(>70).
3. V364, fix a bug of BT and Wifi coexist (hung in function of
force_wifi_mode())
component/bt: Fix the bug of master don't send pair request to the slave when the sec_act set to the value of ESP_BLE_SEC_ENCRYPT.
See merge request !1376
1. move settings of WIFI_CLK_EN_REG for bluetooth into controller init/deinit APIs
2. modify the bit mask used in phy_rf init/deinit to use WIFI-BT shared bits
This commit updates various test cases throughout esp-idf such that
the values used for timer divider pass the assertions in the timer component.
Timer divider values must be between 2 to 65536
Previously esp_restart would stall the other CPU before enabling RTC_WDT.
If the other CPU was executing an s32c1i instruction, the lock signal
from CPU to the arbiter would still be held after CPU was stalled. If
the CPU running esp_restart would then try to access the same locked
memory pool, it would be stuck, because lock signal would never be
released.
With this change, esp_restart resets the other CPU before stalling it.
Ideally, we would want to reset the CPU and keep it in reset, but the
hardware doesn't have such feature for PRO_CPU (it is possible to hold
APP_CPU in reset using DPORT register). Given that ROM code will not use
s32c1i in the first few hundred cycles, doing reset and then stall seems
to be safe.
In addition to than, RTC_WDT initialization is moved to the beginning of
the function, to prevent possible lock-up if CPU stalling still has any
issue.
1. Make sure that 8MD256 clock used to estimate XTAL frequency is enabled
before trying to use rtc_clk_cal_ratio.
This fixes "Bogus XTAL frequency: 0 MHz" warnings after software reset.
2. Don't call rtc_clk_xtal_freq_estimate if XTAL frequency is already
known. This reduces startup time after deep sleep or software reset.
3. Compare known XTAL frequency and estimated one before printing a
warning. This fixes "Possibly invalid CONFIG_ESP32_XTAL_FREQ setting
(40MHz). Detected 40 MHz." warnings.
Previous implementation waited for 20us after setting
RTC_CNTL_SOC_CLK_SEL_XTL register, using ets_delay_us, assuming that
the CPU was running at XTAL frequency. In reality, clock switch happened
on the next RTC_SLOW_CLK cycle, and CPU could be running at the previous
frequency (for example, 240 MHz) until then.
ets_delay_us would wait for 20 us * 40 cycles per us = 800 CPU cycles
(assuming 40 MHz XTAL; even less with a 26 MHz XTAL).
But if CPU was running at 240 MHz, 800 cycles would pass in just 3.3us,
while SLOW_CLK cycle could happen as much as 1/150kHz = 6.7us after
RTC_CNTL_SOC_CLK_SEL_XTL was set. So the software would not actually wait
long enough for the clock switch to happen, and would disable the PLL
while CPU was still clocked from PLL, leading to a halt.
This implementation uses rtc_clk_wait_for_slow_cycle() function to wait
until the clock switch, removing the need to wait for a fixed number of
CPU cycles.
Some RTC features are synchronized to RTC_SLOW_CLK, so sometimes
software needs to wait for the next slow clock cycle.
This function implements waiting using Timer Group clock calibration
feature.
append adc support and api
- esp_err_t adc2_config_width(adc_bits_width_t width_bit);
- esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten);
- int adc2_get_voltage(adc2_channel_t channel);
The mutex is common across all the threads. It needn't be held across
the init_routine() call as long as the 'once' behaviour is guaranteed
Saw a deadlock case, where init_routine of one thread was waiting for
the completion of init_routine in another thread.
t2: wait for command
t1: pthread_once:
lock once_mux
init_routine:
inform thread t2
wait for signal from t2
t2: received command
pthread_once
lock once_mux (already held by t1)
---- Deadlock ----
Reported from:
https://github.com/espressif/esp-idf/issues/703https://github.com/espressif/esp-idf/issues/917
In uart driver we didn't change the default value of tx idle num, so there would be a delay after tx FIFO is empty.
1. Add API to set tx idle interval before next data transmission. (The UART hardware can add an interval after tx FIFO is empty).
2. Set default tx idle interval to zero.
3. Add hardware disable in uart driver delete function.
1. add sw interrupt cause osi to controller.
2. modify the kconfig to improve the option view.
3. add option of the cpu core which bluedroid run.
4. add option of the cpu core which bluetooth controller run.
Previously ioctl was declared as a macro in lwip/sockets.h.
Disabling LWIP_POSIX_SOCKETS_IO_NAMES removed that declaration.
This adds sys/ioctl.h file and the missing declaration.
Also adds missing includes in vfs.c.
Reported from different sources from github or bbs:
https://github.com/espressif/esp-idf/issues/680https://github.com/espressif/esp-idf/issues/922
We tested reading several sensor or other I2C slave devices, if the power and SDA/SCL wires are in proper condition, everything works find with reading the slave.
If we remove the power supply for the slave during I2C is reading, or directly connect SDA or SCL to ground, this would cause the I2C FSM get stuck in wrong state, all we can do is the reset the I2C hardware in this case.
After this commit, no matter whether the power supply of I2C slave is removed or SDA / SCL are shorted to ground, the driver can recover from wrong state.
We are not sure whether this the save issue with the reported one yet, but to make the driver more robust.
Further information:
1. For I2C master mode, we have tested different situations, e.g., to short the SDA/SCL directly to GND/VCC, to short the SDA to SCL, to un-plug the slave device, to power off the slave device. Under all of those situations, this version of driver can recover and keep working.
2. Some slave device will die by accident and keep the SDA in low level, in this case, master should send several clock to make the slave release the bus.
3. Slave mode of ESP32 might also get in wrong state that held the SDA low, in this case, master device could send a stop signal to make esp32 slave release the bus.
Modifications:
1. Disable I2C_MASTER_TRAN_COMP interrupt to void extra interrupt.
2. Disable un-used timeout interrupt for slave.
3. Add bus reset if error detected for master mode.
4. Add bus clear if SDA level is low when error detected.
5. Modify the argument type of i2c_set_pin.
6. add API to set timeout value
7. add parameter check for timing APIs
This commit makes configUSE_TRACE_FACILITY and
configUSE_STATS_FORMATTING_FUNCTIONS configurable in kconfig. Test cases fro the
functions enabled by the two configurations above have also been added.
Test cases for the following functions have been added...
- uxTaskGetSystemState()
- uxTaskGetTaskNumber()
- vTaskSetTaskNumber()
- xEventGroupClearBitsFromISR()
- xEventGroupSetBitsFromISR()
- uxEventGroupGetNumber()
- uxQueueGetQueueNumber()
- vQueueSetQueueNumber()
- ucQueueGetQueueType()
Test cases for the following functions were not required...
- prvListTaskWithinSingleList()
- prvWriteNameToBuffer()
- vTaskList()
Internal byte accessible memory starts with Internal ROM 1 at 0x3FF90000.
Region of RTC fast memory starting at 0x3FF80000 is not used in IDF as
it is mapped to PRO CPU only.
During a call to multi_heap_malloc(), if both these conditions were true:
- That heap only has one block large enough for the allocation
(this is always the case if the heap is unfragmented).
- Another allocation is simultaneously occurring in the same heap.
... multi_heap_malloc() could incorrectly return NULL.
This caused IDF heap_caps_malloc() and malloc() to also fail, particularly
often if only one or two heaps had space for the allocation (otherwise
heap_caps_malloc() fails over to the next heap).
1. Fix WiFi timer enable twice issue
2. Fix a softAP compatibility issue
3. Fix ebuf alloc counter issue
4. remove nvs_flash_init() in esp_wifi_init()
5. Fix scan only find few APs after set bssid
6. Fix can not connect to hidden SoftAP
7. Remove group key entry before connecting ot AP
- _FS_TINY: disables per-file caches
- _FS_TIMEOUT: locking timeout for concurrent access
- _FS_LOCK: prevents operations which are not allowed on open files
Also sets _MAX_SS based on sector size configured for wear_levelling.
This reduces memory usage of FATFS if wear_levelling is using 512 byte
sectors.
Moves the ets_timer_arm() / ets_timer_disarm() code paths to RAM
Overhead is 740 bytes of IRAM, 0 bytes DRAM
(For comparison: If all of esp_timer.c is moved to RAM, overhead is 1068 bytes IRAM and 480 bytes DRAM.)
Allows fcntl() implementation in vfs to be used.
Closes https://github.com/espressif/esp-idf/issues/1070
Note this is different to the other libc file-related syscalls, as there is no
reent structure involved.
Some frameworks based on ESP-IDF need to be able to decide whether to
initialize SPI RAM after the application has started. This change splits
out part of esp_spiram_init which manipulate cache MMU into a separate
function. Applications can disable cache, call esp_spiram_init_cache,
re-enable cache, and then call esp_spiram_init.
Disabling and re-enabling the cache can be achieved using functions
provided in esp_spi_flash.h.
This commit fixes bugs with the dual core changes to freeRTOS tick and idle hooks.
Interrupt watchdog now registers tick hooks to both cores.
API for cross core tick and idle hook registration were also added
Do some refactor to socket ping:
1. Add ping_deinit to kill ping thread
2. Apply configuration set by esp_ping_set_target to socket ping
3. Limit only one ping thread
Previously the timeout was set to the same value (1000ms) for all kinds
of commands. In some cases, such as with slow cards, write commands
failed to complete in time.
This change makes command timeouts configurable via sdmmc_host_t
structure, and also makes default timeouts different for ordinary
commands and write commands.
Closes https://github.com/espressif/esp-idf/issues/1093
Ref TW15774.
Previously if multiple tasks had been added to xPendingReadyList for the CPU, only the first one was resumed.
Includes a test case for resuming multiple (pending) tasks on xTaskResumeAll().
Document the limitation that while scheduler is suspended on one CPU, it can't wake tasks on either CPU.
The way these hooks are implemented at the moment, once you register a tick or idle task hook, it is run by both cores, leading to intermittent crashes that are difficult to explain (and debug). One solution is to register the hook with the core that is currently running, which is what this patch attempts to do.
Merges https://github.com/espressif/esp-idf/pull/781
using apll_param to setup APLL
new apll calculation method, much faster
validate freq calculation
Ensure that the i2s frequency is greater than the hardware limit
Add description of how to calculate apll clock, support apll for other 16-bits audio, check rev0 chip
correct space
* Only direct invocation of cypto_hash_sha256 & crypto_hash_sha512 produced correct output.
* Some remaining header file mixups, so changed approach to wrapping the state structures.
* Fixes https://github.com/espressif/esp-idf/issues/1044 (crypto_sign problems)
* Add option to disable mbedTLS implementation for SHA256 & SHA512 in libsodium
All options that were enabled via CONFIG_MDNS are now in menuconfig, with
the default values set the same as with CONFIG_MDNS enabled (meaning existing
projects that were using CONFIG_MDNS do not need to change).
* setsockopt(s, IPV6_ONLY, &one, sizeof(int)) will disable IPV6-only
mode. Incoming/outgoing IPV4 packets are dropped.
* Otherwise, sockets bound to IPV6_ANY_ADDR can receive unicast packets
for IPV4 or IPV6.
* sendto() a IPV6-mapped-IPV4 address on a UDP socket works correctly
(not supported for RAW or TCP sockets.)
* getaddrinfo() option AI_V4MAPPED is implemented.
As well as extending support to TCP & RAW, there is some potential improvement
to dropping incoming packets - the drop happens a bit late in the process and
there is no "ICMP port unreachable" response sent.
Legacy API of task watchdog used the same function esp_task_wdt_feed() to add
and feed a task. This caused issues of implicitly adding a task to the wdt list
if the function was used in shared code.
The new API introduces init, adding, feeding, deleting, deinit functions. Tasks
must now be explicitly added to the task watchdog using their handles. Deletion
must also be explicit using task handles. This resolves the issue of implicit
task additions to the task watchdog due to shared code calling
esp_task_wdt_feed().
Task watchdog is now fully configurable at runtime by calling the init and
deinit functions.
Also added functions to get the handles of idle tasks of the other core. This
helps when adding idle tasks to the watchdog at run time.
Configuring the task watchdog using menu config is still available, however
menu config will only result in calling the init and add functions for idle
tasks shortly after the scheduler starts.
Menu config also allows for using legacy behavior, however the legacy behavior
willcall the new API functions but with slight variations to make them legacy
compatible.
Documentation and example have also been updated
gcov_rtio.c headers updated to prevent error of freertos header files being
included in the wrong order.
Resolves issue TW#13265
The two task watchdog timer bugs are as follows...
1) If only a single task existed on the wdt task list, and esp_task_wdt_feed()
was only called once, the watchdog triggers but fails to print task name
2) If a single task already exists on the task wdt list, and another task calls
esp_task_wdt_feed() once, the watchdog fails to trigger
Problem stemmed from the loop responsible for resetting the watchdog timer
having incorrect loop parameters. The loop failed to traverse the full length
of the task wdt list
In release mode, switches in rtc_clk_bbpll_set would be converted to
jump tables. These tables would be placed into .rodata, which caused
rtc_clk_cpu_freq_set to be unusable while cache is disabled. This
manifested itself in crashes when exiting from light sleep:
https://esp32.com/posting.php?mode=reply&f=13&t=3089#pr14590
get IP address after connecting to the softap.
Now the default netif is station in station+softap mode. The UDP pcb of
DHCP server is binded to IP 0.0.0.0. When other device connects to softap, the
DHCP offer will be sent by softap.But because the destination IP of DHCP offer
is broadcast IP and the source IP of it is 0.0.0.0, it will be sent from default
netif, that is station interface. Other device can not receive the DHCP offer
sent from station interface. As a result, other device can not get IP address.
The resolution is that bind UDP pcb to the IP address of softap. So, the source
IP of DHCP offer is that of softap. DHCP offer can be sent from softap interface
by source IP route method.
Added documentation about the ESP-IDF changes to FreeRTOS.
The documentation covers changes to the following FreeRTOS aspects.
- Task Creation
- Affects on scheduling (Task skipping, scheduler suspension, tick synchronicity)
- Critical sections and disabling interrupts
- Thread Local Storage Pointers and deletion callbacks
- Configuring ESP-IDF FreeRTOS
Previously, nvs_flash_init_custom would not be called if Storage for a
particular partition was already created. This caused issues if the
first call to nvs_flash_init failed due to Storage init error. This issue
exhibited itself as random failures of NVS CI test.
With this change, storage object is deleted (and not added to storage
list) if initialization fails.
squash the commit.
component/bt:Added the update_white_list & set_prefer_conn_params API to the bt project.
component/bt: Added the get white list size API & delete the read adv tx power API.
component/bt: Change the esp_gap_ble_api.h esp_ble_gap_set_prefer_conn_params API docs.
changed btm_find_dev to btm_find_or_alloc_dev
component/bt: Change the rssi API deep copy method.
component/bt: Change the code as comment in the gitlab.
squash the commit.
component/bt:Added the update_white_list & set_prefer_conn_params API to the bt project.
component/bt: Added the get white list size API & delete the read adv tx power API.
component/bt: Change the esp_gap_ble_api.h esp_ble_gap_set_prefer_conn_params API docs.
changed btm_find_dev to btm_find_or_alloc_dev
component/bt: Change the rssi API deep copy method.
component/bt: Change the code as comment in the gitlab.
component/bt: change the ESP_BLE_CONN_PARAM_UNDEF redefinition error.
component/bt: Change the ESP_BLE_IS_VALID_PARAM function with the compile error.
New multi_heap code has proven effective at aborting when buffer overruns occur,
but it's currently hard to debug the stack traces from these failures.
1. add adc2 coexistence
2. change NOW() to WDEV_NOW()
3. call ets_timer_done() before calling ets_timer_setfn()
4. fix the bug that api lock is not unlocked when call esp_wifi_stop()
twice
5. more hmac tx buffer limit from 32 to 64.
1. Support built-in ADC for I2S.
2. Modify code of ADC, made no change to the original APIs.
3. Add APIs in I2S:
esp_err_t i2s_set_adc_mode(adc_unit_t adc_unit, adc1_channel_t adc_channel);
4. Add I2S ADC/DAC example code.
5. add old-fashion definition to make it more compatible
6. replase spi_flash_ APIs with esp_partition_ APIs
7. add example of generating audio table from wav
8. change example sound
squash again all the commit.
component/bt: Change all the gattc API && bta gattc layer.
component/bt: Debug the code and change the btc_ble_gattc_get_db method.
component/bt: Change the gatt read API interface.
component/bt: Reconstruction the BTA_gattc_cache code.
component/bt: Change back the bluedroid_get_status to marco.
component/bt: Added the serch service res start_handle & end_handle to the result.
component/bt: Change the gattc docs format.
component/bt: Change the docs format.
component/bt: fix the read char value bug.
component/bt: change the gattc_get_attr_count method.
component/bt: Change back the bta_gattc write ccc code.
component/bt: Change the gattc api docs format
component/bt: Change the gattc API docs.
component/bt: Change the prepare write descriptor method to avoid the exection.
Component/bt: modify gatt clinet demo with new API
component/bt: Change the p_src_data->read.p_value to avoid exection.
compoent/bt: Change the bugfix of gattc unreg for the notify.
Modify gattc security demo
component/bt: Change the log error.
Component/bt: modify gattc_multi_connect demo
componnet/bt: Change the bta_gattc_cache sdp include.
component/bt: Change the start_handle & end_handle not from the service.
component/bt: Change the gattc API docs.
component/bt: Change the return issues.
component/bt: Fixed the include service bug.
component/bt: Modify gattc_multi_connect demo , add scan log
component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug.
component/bt: Fix the invalid handle of the get all char issues.
component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue.
component/bt: Fixed the get secondly service num not correct issue.
component/bt: Fixed the last service handle not correted issue.
1. Occupy conn[9] for adv. The max connection number of bluetooth controller decrease to 9. (Previously, it is 10)
2. modify the enum of setting BLE TX power corresponding to connection's.
3. fix libbtdm_app.a cwitch jump table
ESPNOW is a kind of WiFi communication bettween WiFi devices, no
matter they are connected to each other or not. Once two WiFi
devices are paired, they can send data to or receive data from
each other. The data is transmitted in action frame which can
be encrypted with CCMP method. ESPNOW also support mutilcast frame
transmitting.
When debugging crashes caused by flash cache access errors, OpenOCD may
request the value of uxTopUsedPriority when cache is disabled. Placing
it into IRAM to avoid an error in such case.
Since 9a8c0392, XTAL frequency is set to 40MHz by default, and users
of 26MHz boards need to select 26MHz manually. Most users are not aware
of this change, and existing getting started guides do not mention that
XTAL frequency needs to be set for some boards. So users are left with
garbage output from UART without any clue what to check.
This change adds a warning in case specific XTAL frequency was set, and
it does not match automatically detected one. This should help users
fix the issue.
1. Remove the bond_device global variable.
2. Fix bond_device add cause memory exception
3. Modify the code location.
4. modify thread security
5. remove esp_ble_clear_bond_device_list() API
6. modify esp_ble_get_gond_device_list() to return list immediately, rather than wait event.
7. modify the gatt_security_server demo to show how to remove all the bonded devices.
8. fix some code bugs may cause something error.
Fix warnings where undefined vars are used.
Make Kconfig emit "FOO=" for unset bool options
To ensure make variables are always defined, even if empty.
When writing auto.conf, include symbols disabled by dependency to make sure all make variables are always defined.
Fixesespressif/esp-idf#137
Cherry-picked from https://github.com/espressif/esp-idf/pull/138
Unlocking a never-locked mutex is an assertion failure in debug mode.
In release mode, this further improves performance:
No-Contention -> 153 cycles
Recursion No-Contention -> 138 cycles
Contention -> 378 cycles
Regression introduced in 43e231c.
Thanks to @yanbe for pointing out issue in https://github.com/espressif/esp-idf/pull/955
This is a different fix, tries to keep the behaviour that 43e231c was aiming to correct (unnecessarily testing an
invalid slot more than once.)
Previously NVS did check CRC values of key-value pairs on the active
page, but the check for full pages was missing. This adds the necessary
check and a test for it.
Since timestamps are 64-bit, loosing one bit of range due to sign does
not present an issue, however for applications doing calculations on
timestamps, signed return type is more convenient.
The implementation of esp_timer_get_time used a critical section, which
resulted in a call time of ~1.8us. To make esp_timer_get_time more
useable as a high-resolution time source, this change replaces the lock
with polling. Call time is reduced to ~0.7us.
- update connection parameters timeout due to master update illegal connection parameters
- slave returns error status when slave check the connection parameters
- slave connection parameters update callback get that interval_max is equal to interval_min
Added component containg API that is able to correct raw ADC readings
into a voltage in mV. Also provided a helper function that combines
the process of getting the raw ADC1 reading then converting it to a
voltage in mV. In doing so, the adc1_get_voltage() function of the ADC
driver has been deprecated. Instead there is now adc1_get_raw to obtain
the raw ADC1 reading, and adc1_to_voltage() that gets the raw reading
and converts all in one function. Functions using the deprecated
adc1_get_voltage() have also been updated to use adc1_get_raw().
Conversion is based on ADC characteristics. The characteristics are based
on the ADC's v_ref, herefore the appropriate structure and functions have
been provided to obtain the ADC characteristics.
The existing ADC driver has also been modified by adding a function to
route the internal ADC reference voltage to a GPIO allowing users to measure
it manually.
Relevant documentation has also been updated
All peripheral clocks are default enabled after chip is powered on.
When CPU starts, if reset reason is CPU reset, disable those clocks
that are not enabled before reset. Otherwise, disable all those
useless clocks.
These peripheral clocks must be enabled when the peripherals are
initialized and disabled when they are deinitialized.
The code in xtensa_vectors.S did not handle XT_DEBUG_BACKTRACE
consistently: #if was used in one case, and #ifdef in another. This makes
the checks consistent, and also introduces a Kconfig option to enable
backtrace.
In some cases, xPortGetCoreID was not inlined, and ended up in flash.
Since this function is used in many situations when cache is disabled,
that caused exceptions. Adding IRAM attribute to fix that.
vfs_uart used same locks for read and write operations on a single UART.
If read operation was blocking (i.e. carried out via UART driver), the
lock was held by reading task until it received a line. During this time,
other tasks trying to write to the same UART would get blocked.
This change introduces separate read/write locks, and adds a test.
Another vfs_uart test if fixed (it was disabled since the
CONFIG_NEWLIB_STDOUT_ADDCR option was removed).
If two different types of SHA hashes were active in the hardware
concurrently, a race condition meant the SHA unit could be incorrectly
reset leading to all-zero results.
If scheduler switches cores in narrow window during esp_dport_access_stall_other_cpu_start(), could cause the stall
interrupt to occur on the running CPU - halting the CPU until WDT cleans up.
Related to https://github.com/espressif/esp-idf/issues/630
1. BIT(8) of CTRL is actually read-only bit indicating interrupt status
2. BIT(0) or CTRL had inverted meaning: 1 is “level”, 0 is “edge”
3. Add definitions of prescaler values
1. remove GKI(not use osi_free_and_reset)
2. modify mutex/semaphore to individual directory
3. set osi_malloc as malloc(previously use calloc)
4. change osi allocator debug osi_free
5. fix rebase of remove GKI
1. add sens_struct.h
2. add definition of RTCCNTL and RTCIO
3. modify touch pad examples
4. update example code.
5. add comments add option in menuconfig
6. fix issue that pad index 8 and 9 are mismatched
7. add touch_pad_read_filtered() api to get value filtered by iir filter
8. modify touch pad isr func
9. Make the items in perihperal.ld in the sequence of address
10. delete Kconfig for touch pad
11. add touchpad filter APIs to adjust the filter
12. add touch_pad into index.rst
13. add touch_pad in Doxyfile
14. add touch_pad.rst
This commit adds support for multiple NVS partitions. This provides application a flexibility to have multiple NVS
partitions such as separate partition with read-only manufacturing data and read-write partition with configuration.
Application can also use this to separate out application's configuration storage from system configuration.
This feature does not change any of the basic property of NVS subsystem. The same-named namespaces across partitions are
considered to be different namespaces. The original NVS API available for the applications remains unchanged. The only
difference is that instead of first NVS partition in the partition table, it now operates on the partition with label
"nvs" (which is default in the IDF provided partition table files). Additional APIs are provided to open a handle and
erase NVS with partition name as a parameter.
A test case is added in the host tests and it is made sure that all the host tests pass. nvs_rw_value app is also tested
with multiple partitions.
Signed-off-by: Amey Inamdar <amey.inamdar@gmail.com>
- The two most significant bits of the address shall be equal to 1
- All bits of the random part of the address shall not be equal to 1
- All bits of the random part of the address shall not be equal to 0
We had already updated to v1.24 months ago, but the submodule commit was accidentally
reverted in 1fb85b494c.
Fixes (again) error when compiling with assertions disabled.
As reported on forum: https://esp32.com/viewtopic.php?f=13&t=2750&p=13069
component/bt: cherry-pick the bugfix/btdm_api_manage_pair_info_#13119 to this branch.
component/bt: Change the ble gap API code format & added the status judgment in the btc_storage_load_bonded_ble_devices function.
Previously VFS driver for UART could only use simple non-blocking
functions to read from and write to the UART. UART driver provides more
complex blocking and interrupt-driven functions, which can be used
instead.
This commit adds optional support for using UART driver's functions.
Also added is a more flexible mechanism for configuring newline
conversion rules on input and output.
This commit also fixes a bug that all UARTs shared one static variable
used as a character buffer in newline conversion code. This variable is
changed to be per-UART.
* Disables 3DES, Camellia, Blowfish, RC4, RIPEMD160, SSLv3, TLS-PSK modes, DTLS by default
* Saves about 40KB from the default TLS client code size
* Defaults no longer get "Bad" howsmyssl.com rating (no more vulnerable 3DES)
(ping https://github.com/espressif/arduino-esp32/issues/575 )
* Allows up to another 20-30KB code size to be trimmed without security
implications if using DER formatted certificates, RSA ciphersuites only,
etc.
* Can save up to another 8KB by setting the TLS Role to Server or Client only.
1. Hello World application shows no footprint difference before and
after this change
2. examples/ethernet/ethernet application compiles properly (can't
test with my board)
By default SD cards are initialized in default speed (DS) mode. Enabling
HS mode requires SWITCH_FUNC command to be sent twice: first time to
query if the card supports switching to HS mode, second time to perform
the switch.
This change implements SWITCH_FUNC command and adds the procedure to
switch to HS mode.
In some cases the card needs to be returned to standby mode from data
transfer mode. This is done using CMD7 command, which does not receive
any response in this case.
‘make_hw_cmd’ function checks opcodes in a few cases. Comparing opcode
does not tell the whole story, because for some SD commands there is are
APP commands with the same opcodes. This change introduces a flag which
indicates whether the next command is going to be an APP command.
The check for APP_SET_BUS_WIDTH command is updated to use this flag.
This fixes a bug with an unexpected STOP_TRANSMISSION command sent after
SWITCH_FUNC command, which has opcode 6, same as APP_SET_BUS_WIDTH.
MMC_RSP_BITS helper function had a hack that it flipped word order in
the response, assuming that response size is 4 words. This hack does not
work for responses which are not 4 words long (such as the SWITCH_FUNC
response, which is 64 words long).
This change removes the hack and the matching word order reversal code
in sdmmc driver.
Remove wifi config option
Remove Wi-Fi enable/disable option from Kconfig. This can be detected by the presence of esp_wifi_init() function in the application. Minimum footprint impact after the change.
See merge request !1098
This is no longer required since the functions automatically get
pulled in based on the usage. A quick summary of footprint
comparisions before and after these set of patches is shown below:
Hello-World: (simplified for readability)
old Total image size:~ 104902 bytes (.bin may be padded larger)
old Total image size:~ 105254 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
Archive File DRAM .data & .bss IRAM Flash code & rodata Total
old libesp32.a 1973 177 4445 3939 2267 12801
new libesp32.a 1973 185 4473 3939 2267 12837
new libnvs_flash.a 0 92 0 274 8 374
new libstdc++.a 0 0 0 24 0 24
For some reason, nvs_flash.a (~400bytes) gets pulled in (particularly
the nvs_flash_init() function).
Power-Save: (simplified for readability)
old Total image size:~ 421347 bytes (.bin may be padded larger)
old Total image size:~ 421235 bytes (.bin may be padded larger)
old libtcpip_adapter.a 0 81 0 1947 115 2143
new libtcpip_adapter.a 0 69 0 1897 115 2081
The size actually shrinks a bit, since the AP interface function
doesn't get pulled in.
Since only the used interface's start function gets called, it pulls
in only the functions that are required in the current application,
thereby saving footprint.
Restart being a lower-layer system-level function, needn't depend on
the higher level Wi-Fi libraries.
This also enables us to get rid of one more WIFI_ENABLED ifdef check
1. Rename api from rmt_get_ringbuf_handler to rmt_get_ringbuf_handle (Github Issue #274)
2. doxygen param rename
3. change API rmt_wait_tx_done to specify maximum waiting time
4.Change return type of rmt_wait_tx_done API from bool to esp_err_t
5. update doc
The address field should be placed at the highest bits of address and slv_wr_status registers. Instead of breaking the address into two parts and fill in each register, move the address to the highest bits and write to the registers respectively.
Breaking change: if you fill-in the SPI address filed in a previous version in some way and it works correctly, you still have to rewrite the address, in a more intuitive way.
force rxlength=length and mosi=1 and inlink.start=1 on in full-duplex mode.
set rxlength > length is forbidden in full-duplex mode.
TW#12609, TW#14240, https://www.esp32.com/viewtopic.php?f=13&t=2519
SDMMC hardware treats all buffers as aligned, and ignores 2 LSBs of
addresses written into DMA descriptors. Previously SDMMC host driver
assumed that data buffers passed from SDDMC command layer would be
aligned. However alignment checks were never implemented in the command
layer, as were the checks that the buffer coming from the application
would be in DMA capable memory. Most of the time this was indeed true.
However in some cases FATFS library can pass buffers offset by 2 bytes
from word boundary. “DMA capable” restriction may be broken if pSRAM
support is used.
This change adds buffer checks to the SDMMC host driver (alignment and
DMA capability), so that the host layer will error out for incompatible
buffers. In SDMMC command layer, a check is added to read and write
functions. If an incompatible buffer is passed from the application, new
buffer (512 bytes size) is allocated, and the transfer is performed
using {READ,WRITE}_SINGLE_BLOCK commands.
Optimize TCP close:
1. Not remove TCP pcb when IP address is changed since the lwip netconn still need the pcb
2. If the TCP connection is in TCP_FIN_WAIT_1 for too long time, remove it
SD SPI mode driver
This MR adds functionality to support SD cards connected via SPI interface.
Additionally, two bugs are fixed:
- Definition of `SPI_TRANS_MODE_DIOQIO_ADDR` in spi_master driver
- SD card probing frequency was 4000kHz instead of 400kHz as required by the standard
See merge request !727
gpio_matrix_out function will set output enable for GPIO, seems in gpio_matrix_out there will be a short moment that the chip will output GPIO level.
So we can set GPIO as high before gpio_matrix_out function.
Makes app image booting more reliable (256-bit rather than 8-bit verification.)
Some measurements, time to boot a 655KB app.bin file and run to app_main() execution.
(All for rev 1 silicon, ie no 340ms spurious WDT delay.)
80MHz QIO mode:
before = 300ms
after = 140ms
40MHz DIO mode:
before = 712ms
after = 577ms
40MHz DIO mode, secure boot enabled
before = 1380ms
after = 934ms
(Secure boot involves two ECC signature verifications (partition table, app) that take approx 300ms each with 80MHz CPU.)
For config-only components, component.mk should now contain "COMPONENT_CONFIG_ONLY := 1"
Also refactored some of the generation of linker paths, library list. This required cleaning up the way the bootloader
project works, it's now mostly independent from the parent.
1. add ble tx power functions
2. add more osi functions.
3. modify bluetooth controller task procedure
4. fix a memory leak when controller deinit
5. add controller disable return value.
NVS is used to store PHY calibration data, WiFi configuration, and BT
configuration. Previously BT examples did not call nvs_flash_init,
relying on the fact that it is called during PHY init. However PHY init
did not handle possible NVS initialization errors.
This change moves PHY init procedure into the application, and adds
diagnostic messages to BT config management routines if NVS is not
initialized.
In ecp_mul_comb(), if (!p_eq_g && grp->T == NULL) and ecp_precompute_comb() fails (which can happen due to OOM), then the new array of points T was leaked.
Currently the last 128KB of DRAM is reserved for the bootloader & early boot stacks. This means if >192KB of static DRAM
is allocated, the only available heap is this region - which is disabled until the scheduler starts. As a result, you
get either heap corruption on early boot if the static data overlaps startup heap (leading to very weird errors), or
FreeRTOS will fail to start when it can't malloc() anything.
Long term fix is to move the stacks & bootloader data to the very end of RAM, and only reserve that part for early
boot. This is a little fiddly because of also wanting to make sure this memory is not preemptively fragmented when it
gets reintroduced to the heap. This will become more important if/when we have more static allocation options in the
future.
For now, these errors make it clear why the boot has failed.
Ref TW13909
Because of errata related to BOD reset function, brownout is handled as follows:
- attach an ISR to brownout interrupt
- when ISR happens, print a message and do a software restart
- esp_restart_nonos enables RTC watchdog, so if restart fails,
there will be one more attempt to restart (using the RTC
watchdog)
RTC watchdog didn’t have any actions configured for any of the stages.
This change configures it to use SW_SYSTEM_RESET at stage 0 and a
full reset at stage 1. The timeout is now calculated based on
RTC_SLOW_CLK frequency.
unused variable 'lfn'
'isr_handler' defined but not used
'servo_set_angle' defined but not used
'gpio_test_signal' defined but not used
'change_duty' defined but not used
component/bt: Fixed the bug crash of disconnet BLE when close the SMP module in the menuconfig.
component/bt: Removed the Excess #endid ///SMP_INCLUDED == TRUE in the l2cu_no_dynamic_ccbs function.
If destination IP address of the packet is broadcast address, firstly compare
source IP address with the that of each network interface. If it matches,
packet is forwarded from the interface.
If scheduler was running, and lock was an automatic variable (ie stack-allocated) to be initialised by _lock_init*,
initialisation could be skipped if the lock variable was non-zero (and lock would be left invalid).
In other cases the lock is statically initialised to zero by __LOCK_INIT*
Specifying -fexceptions for the compiler is not enough.
- add necessary zero padding after .eh_frame section
- link .gcc_except_table_table in a way flash script does not complain
- call __registrer_frame_info before global constructors
Kudos jcmvbkbc for the necessary help.
Implements support for system level traces compatible with SEGGER
SystemView tool on top of ESP32 application tracing module.
That kind of traces can help to analyse program's behaviour.
SystemView can show timeline of tasks/ISRs execution, context switches,
statistics related to the CPUs' load distribution etc.
Also this commit adds useful feature to ESP32 application tracing module:
- Trace data buffering is implemented to handle temporary peaks of events load
Fixes issue with GPIO 0 being enabled as an output on ESP32D2WD (or when setting SPI pins in efuse)
and not using Quad-I/O modes.
Ref: https://esp32.com/viewtopic.php?f=2&t=2205
Bug occurs when core dump destination in menuconfig is set to flash. When
programme crashes, xt_unhandled_exception or panicHandler will both trigger
commonErrorHandler. commonErrorHandler calls esp_core_dump_to_flash which
will attempt to use DPORT functions and hang due to trying to a stall and already
stalled processor (already stalled in xt_unhandled_exception and panicHandler).
Program will eventually be rebooted when wdt expires.
Added esp_dport_access_int_deinit after calls to haltOtherCore() so that DPORT
functions don't try to halt and already halted cpu hence preventing hang.
Fixes TW#12944 https://github.com/espressif/esp-idf/issues/646
Previously opendir("/data") would fail if filesystem with "data" prefix
was registered in VFS, while opendir("/data/") would succeed.
This change fixes handling for the former case and adds relevant tests.
Updated test case to include configASSERT cases (+1 squashed commits)
Squashed commits:
[871ec26f] Freertos:Bugfix uxTaskGetSystemState
Bug (github #12142) with uxTaskGetSystemState where
if called immediately after creating a bunch of tasks,
those tasks would be added twice into the TaskStatusArray.
Bug caused due to use old implementation using vTaskSuspendAll
which did not stop newly created task on other core from accessing the
read/waiting task lists whilst the list were being read by
uxTaskGetSystemState. Fixed bug by replacing vTaskSuspendAll
with taskENTER_CRITICAL and added test case for the bugfix
Small changes to clock calibration value will cause increasing errors
the longer the device runs. Consider the case of deep sleep, assuming
that RTC counter is used for timekeeping:
- before sleep:
time_before = rtc_counter * calibration_val
- after sleep:
time_after = (rtc_counter + sleep_count) * (calibration_val + epsilon)
where 'epsilon' is a small estimation error of 'calibration_val'.
The apparent sleep duration thus will be:
time_after - time_before = sleep_count * (calibration_val + epsilon)
+ rtc_counter * epsilon
Second term on the right hand side is the error in time difference
estimation, it is proportional to the total system runtime (rtc_counter).
To avoid this issue, this change makes RTC_SLOW_CLK calibration value
persistent across restarts. This allows the calibration value update to
be preformed, while keeping time after update same as before the update.
1. For now, some security related functions used in classic Bluetooth are controlled by "SMP_ENABLE". This commit fixes the dependency.
2. The two options, "CLASSIC_BT_ENABLED" and "SMP_ENABLED" The two options will be decoupled in the future.
Currently libsodium tests add about 800kB to the binary, which is too
much for a partition table constrained to 2MB. Disable libsodium tests
until we start building multiple unit test apps for different subsets.
This fixes a bug introduced by !848, where APP CPU would not be reset
during esp_restart, if esp_restart was called from a task running on APP
CPU, and wouldn’t be reset by PRO CPU on startup.
This change replaces stalling APP CPU with resetting it.
Also adds a non-automated esp_restart tests.
DPORT access protection can not work when the other CPU is stalled.
Writes to DPORT registers in esp_restart caused the program to hang due
to access protection, and the reset happened due to RTC_WDT, not SW_RST.
This change adds esp_dport_access_int_deinit function and calls it from
esp_restart once the other core is stalled.
In ESP32 rev. 0, switching between 240MHz and 80MHz (even via an
intermediate frequency of 40MHz) may cause the chip to lock up.
The bootloader used to enable 80MHz CPU clock at startup, which could
cause lock up after software reset. With this change, if 240MHz CPU
clock is enabled in menuconfig, bootloader will also use 240MHz to avoid
lock-up.
Run some unit test cases based (poorly) around sodium's test infrastructure.
Increase in unity test task stack is due to signature tests, load a lot of data onto the stack.
- Fix slave initiate service discovery procedure
- Fix master re-discovery every time connection established
- Optimize service discovery char ccc write procedure
- Optimize esp_log_buffer function
- Modify default supervision timeout from 20s to 2s
This seems to clean up some of the more wrong addr2line output results (not
sure why, something to do with optimisations I think - perhaps the return
address may also be a jump target from some earlier line of the code.)
Previously, this resulted in task stack frames turning up incorrectly in the backtrace, ie
Backtrace: 0x400d22a0:0x3ffb0fa0 0x40085a3c:0x3ffb0fc0 0x400f32c4:0x3ffb0fe0 0x40081965:0x3ffb1010
0x400d22a0: esp_vApplicationIdleHook at /home/esp/esp-idf/components/esp32/./freertos_hooks.c:
52
0x40085a3c: prvIdleTask at /home/esp/esp-idf/components/freertos/./tasks.c:4431
0x400f32c4: i2c_isr_handler_default at /home/esp/esp-idf/components/driver/./i2c.c:598
0x40081965: _xt_lowint1 at xtensa_vectors.o:?
Fix is to implement abort() via an unhandled exception rather than a breakpoint, I think
because of relative priority of exception types.
Another approach would be to assign a software-only INUM to abort()ing and defined a
PANIC_RSN_ABORTED, but this is more complex and interrupt numbers are more scarce than RAM!
This change removes the erroneous cast to uint32_t (which caused time to
wrap around after 1 hour) and splits the multiplication into two terms
to remove the wraparound after 13 days.
Ref. https://esp32.com/viewtopic.php?f=13&t=1908
When ‘reset halt’ command is executed, OpenOCD will take the APP CPU
out of reset and enable the clock. At this point, user can set a
breakpoint on code which will run on APP CPU. Previously, app startup
code would do another reset of APP CPU, thereby removing any breakpoints
which may have been set. This change makes APP CPU reset conditional on
DPORT_APPCPU_CLKGATE_EN bit, which is 0 by default but is set to 1 by
OpenOCD after reset.
* Writing >4 bytes to unaligned offsets would fail
* Writiing data from flash would fail (wrong buffer was used)
* Writing >8192 bytes from RAM would over-write data multiple times
Adds test cases for the above.
Previously the first call to rmt_driver_uninstall() would remove the interrupt handler,
even if other channels still had the driver installed.
Adds an OS-level lock to control concurrent registration/deregistration of channels.
xPendingReadyList[1] was never initialised correctly, so if a task is added to this list (ie by xSemaphoreGiveFromISR()
or similar) while scheduler is disabled, then it causes a null pointer dereference.
Bug produces stack traces similar to:
0x40086e87: vListInsertEnd at /home/gus/esp/32/idf/components/freertos/./list.c:130
0x40084ba3: xTaskRemoveFromEventList at /home/gus/esp/32/idf/components/freertos/./tasks.c:3439
0x40083c54: xQueueGiveFromISR at /home/gus/esp/32/idf/components/freertos/./queue.c:2034
0x400f50a0: timer_group0_isr at /home/gus/esp/32/idf/components/freertos/test/./test_suspend_scheduler.c:27
0x40081d7d: _xt_lowint1 at xtensa_vectors.o:?
Writing values longer than half of the page size (with header taken into
account) causes fragmentation issues. Previously it was suggested on the
forum that using long values may cause issues, but this wasn’t checked
in the library itself, and wasn’t documented. This change adds necessary
checks and introduces the new error code.
Documentation is also fixed to reflect the fact that the maximum length
of the key is 15 characters, not 16.
component/bt: squash the branch of the early commit
component/bt: Added the set static random address callback to the bt project.
component/bt: fixed the set static random address error.
component/bt: fixed the set static random address error.
To increase the chances that the examples work out of the box, this
change is raising the default deep sleep wakeup delay to 1ms.
If GPIO15 is low at startup, ROM code takes less time to execute
(because no logging is performed), so more time may be needed to allow
flash chip to become ready.
Triggered on make 3.81, happens sometimes on Linux and always(?) on macOS. May depend on the order the OS' filesystem
resolves wildcards in.
Includes a revert to the LWIP component to verify this is properly fixed.
See also https://github.com/espressif/esp-idf/issues/632
Fix Dport access in interrupts
Dport accesses would re-enable interrupts unconditionally, breaking things when called in an ISR. This saves and restores the interrupt status, fixing this.
This fixes a crash in the SPI slave driver, and possibly other things.
See merge request !772
CI: auto generate configs for test jobs
Currently CI test jobs are static configured by several pre-generated config files.
This approach have several disadvantages:
1. not flexible to select test cases to run, which is important feature of @bot
2. difficult to update test as we need to pre-generate quite a lot files
3. need to maintain extra config files in IDF
4. not flexible to support new test apps or chips, can't use some new features of test bench
Therefore we'll add assign_test stage between build and test, to generate configs for test jobs.
See merge request !738
Make internal stack size variables in FreeRTOS 32-bit instead of 16-bit
Stock FreeRTOS uses an uint16 to store stack sizes, making it impossible to allocate a stack >64K. This changes this into an uint32, allowing for larger stacks.
See merge request !677
Partition table gen esp32part fixes: App offset errors, Python 3 support
As mentioned on forums, gen_esp32part.py wasn't erroring correctly if a non-64KB-aligned app partition was referenced.
Also merges a PR to add Python 2&3 support (with some tweaks). Not very useful in IDF right now, but useful for Arduino.
See merge request !751
1. Name change from chopper to carrier, block diagram update, minor changes to example codes
2. mcpwm_reg.h changed, brought uniformity in comments, worked on suggestions, duty to accept float. Some name changes!
3. Minor readme changes and Indetation
4. Minor change: move mcpwm_reg.h and mcpwm_struct.h to new path
5. Minor change: addition of BLDC example code and Readme
6. Name changed from epwm to mcpwm
7. Improve the reg name in mcpwm_struct.h
8. Name change chopper>carrier, deadband>deadtime
component/bt: fix the exception in attp_buil_sr_msg when handling gatt write bug. bug number #12124.
fix the exception in attp_buil_sr_msg when handling gatt write bug.
See merge request !743
Small unit-test-related fixes
Fixes for some small bugs found running unit tests with heap poisoning turned on.
All are bugs in the tests, except for one FreeRTOS fix (when deleting a task, check if it's running on the other CPU and preempt it if so.)
See merge request !746
nvs: remove search cache at page level
Since read cache was introduced at page level, search cache became
useless in terms of reducing the number of flash read operations.
In addition to that, search cache used an assumption that if pointers to
keys are identical, the keys are also identical, which was proven wrong
by applications which generate key names dynamically.
This change removes CachedFindInfo, and all its uses. This is done at
expense of a small extra number of CPU operations (looking up a value in
the read cache is slightly more expensive) but no extra flash read
operations.
Ref TW12505
Ref https://github.com/espressif/arduino-esp32/issues/365
See merge request !753
Since read cache was introduced at page level, search cache became
useless in terms of reducing the number of flash read operations.
In addition to that, search cache used an assumption that if pointers to
keys are identical, the keys are also identical, which was proven wrong
by applications which generate key names dynamically.
This change removes CachedFindInfo, and all its uses. This is done at
expense of a small extra number of CPU operations (looking up a value in
the read cache is slightly more expensive) but no extra flash read
operations.
Ref TW12505
Ref https://github.com/espressif/arduino-esp32/issues/365
1. Enlarge wifi task stack size by 512Bytes to fix potential stack overflow issue
2. Modify wifi hmac tx queue size from 12 to 32 because we already limit the buffer number in ebuf
management module
add API to get chip info
This change adds an API to get chip info, such as chip model, enabled capabilities, size of embedded flash, silicon revision.
Hello_world example is modified to print out the information about the chip. The example is also simplified by moving all code into the main task.
Ref TW12031.
See merge request !549
esp32: update wifi lib for some bugfix
1. Fix wifi ebuf free twice issue
2. Fix wifi internal assert issue
3. Fix a bug in esp_wifi_stop
4. Fix wifi crash issue
5. Fix wifi run out of memory when 10 udp connection stability test
See merge request !745
Optimize configuration of base MAC address
Application developer can call APIs to configure base MAC address
instead of using menuconfig.
See merge request !744
component/esp32 : fix dualcore bug
1. When dual core cpu run access DPORT register, must do protection.
2. If access DPORT register, must use DPORT_REG_READ/DPORT_REG_WRITE and DPORT_XXX register operation macro.
See merge request !742
component/bt: fix adv stop event bug and add attribute table create
- Fix bug that advertising stop event produced while calling start_adv function
- Modify gatt server adv data and scan rsp data raw setting
- Add create attribute table error msg
- Delete redundant printf in previous commits
See merge request !739
1. When dual core cpu run access DPORT register, must do protection.
2. If access DPORT register, must use DPORT_REG_READ/DPORT_REG_WRITE and DPORT_XXX register operation macro.
SPI: Various fixes (examples, mem leak, arg check)
- Fix SPI master example to use DMA-capable memory for display initialization. Fixes https://github.com/espressif/esp-idf/issues/551
- SPI master: Do not leak DMA descriptor pointer array on free
- SPI Master/Slave: Check if DMA'ed buffers actually live in DMA-capable memory
See merge request !735
error
- Fix bug that advertising stop event produced while calling start_adv function
- Modify gatt server adv data and scan rsp data raw setting
- add create attribute table error msg
- Delete redundant printf in previous commits
we'll auto assign cases to test jobs so we don't need those config
files. cases with different wifi modes will now be generated when
creating test case database, we need to remove them from YAML files.
FATFS fixes and tests
This MR includes a set of fixes related to FATFS, SDMMC, and wear levelling:
- `esp_vfs_fat_spiflash_mount` uses `FM_SFD` flag when creating the partition. The volume layout (given in `VolToPart` variable) was not compatible with SFD mode, so mkfs was failing. This fixes the volume layout to use "autodetect" for both volumes. Merges https://github.com/espressif/esp-idf/pull/559.
- fix `prepend_drive_to_path`function, which didn't prepend drive to path (while consuming 2k of stack space)
- fix stack overflow in vfs_fat_link function which allocated two 4kbyte `FIL` structures on the stack
- fix support for having two FATFS instances (in flash and SD) mounted at the same time
- unit tests written for FATFS on SDMMC are made common between SDMMC and WL implementations; FATFS unit tests on WL will run during CI
- fix inconsistent definition of PATH_MAX and ARG_MAX (TW12207, TW12104, https://github.com/espressif/esp-idf/issues/289)
See merge request !732
component/bt: fix some bugs related to bluetooth sniff mode in controller
1. fix some bugs in bluetooth sniff mode in controller
2. export some symbols to esp32.rom.ld including functions and global variables in ROM code
3. update libbtdm.a which includes "IRAM_ATTR" addition or removal for some functions
See merge request !729
fix(lwip): fix tcp connect fail when enable LOOPIF
when enable the LOOPIF, because of use the loopnetif, the TCP connect will fail. see TW12029
See merge request !711
- fix null pointer dereference in VFS when VFS implementations are added
and removed in different order
- vfs_fat_sdmmc, vfs_fat_spiflash: pass correct drive to mkfs
(previously it would always do mkfs in the first drive)
- add test case
This change moves actual test code into test_fatfs_common.c and
refactors setup/teardown code to be contained within separate functions.
For each SDMMC FATFS test, identical test is added which can run with
WL partition in flash.
vfs_fat_link opened two files to perform copy operation. File structures
were allocated on the stack. When _MAX_SS setting was increased in
ffconf.h due to wear levelling feature, the size of these structures
increased to ~4k each (~8k total). This exceeds stack size allocated for
tasks in most typical cases.
This change makes file structures dynamically allocated.
Originally, prepend_drive_to_path was designed to be a macro, and it
modified local path variables to point to a temporary buffers.
When it was converted into a function, modification to path variables
were no longer visible outside of this function.
In addition to that, prepend_drive_to_path allocated 2k bytes on the
stack for temporary path buffers. This is replaced with path buffers
allocated as part of vfs_fat context object. Locking is added around
parts of code which use these temporary buffers.
Additionally, _lock member of vfs_fat_ctx_t was placed after the
variable-sized files array, which caused the first entry in the
array to be never used. This change fixes the order of members
and adds comments.
1. fix some bugs in bluetooth sniff mode in controller
2. export some symbols to esp32.rom.ld including functions and global variables in ROM code
3. update libbtdm.a which includes "IRAM_ATTR" addition or removal for some functions
component/bt:fix the bug with gatt client cant not receive the gatt server service change event.
fix the bug with gatt client cant not receive the gatt server service change event.
See merge request !726
esp32: select 8M clock as RTC_FAST_CLK on startup
Even though RTC_CLK_CONFIG_DEFAULT correctly had RTC_FAST_FREQ_8M as the
fast clock, the bootloader modified fast_freq field to the currently
selected RTC_FAST_CLK (so that the clock choice is not affected by the
bootloader). The application startup code never switched to 8M clock,
which caused the default (XTAL/4) to be used as RTC_FAST_CLK. This had
caused a number of issues, such as touch pads not working in deep sleep.
Fixes https://github.com/espressif/esp-idf/issues/542.
Ref TW12053.
See merge request !709
Assert when a new task is started on a nonexisting CPU
Previously, starting a task on a CPU ID higher than the amount of CPUs FreeRTOS is configured with would not start the task and possibly have unintended side effects due to some out-of-bounds array writes. Assert on this so the app aborts cleanly.
See merge request !701
I2S driver - fixed support for 24 and 32-bits, fixed tx/rx at the same time
- Modify sample can test with 24, 32-bits audio
- Add i2s sample README
- simply i2s_push function
- change sample rates, bits per sample, channel on fly
See merge request !483
Fix SPI master CI test
CI test fails because the values it checks haven't been updated to the changes in the clock calculations. This fixes that.
See merge request !710
Feature/btdm ble bt separa
@Jack @snake @igrokhotkov @angus @island please help to review the code.
Separate the bt/ble code. After the separate, can save 15k~25k ram & 240k~460k code size(depending on the menuconfig).
See merge request !684
optimize scan before station connecting to AP
1. Store the information of AP(ssid, password, bssid, channel, etc)
into nvs when station connects to AP successfully. If station
connects to the same AP next time, it will scan the stored channel of the AP
first.
2. Add a parameter of channel for scanning before connecting to AP.
If the channel is set to 0, station will scan full channels. If it
is set to 1~13, station will only scan the channel.
See merge request !704
1. Store the information of AP(ssid, password, bssid, channel, etc)
into nvs when station connects to AP successfully. If station
connects to the same AP next time, it will scan the stored channel of the AP
first.
2. Add a parameter of channel for scanning before connecting to AP.
If it is set to 1~13, station will scan starting from the channel.
If the channel of AP is unknown, set it to 0.
Even though RTC_CLK_CONFIG_DEFAULT correctly had RTC_FAST_FREQ_8M as the
fast clock, the bootloader modified fast_freq field to the currently
selected RTC_FAST_CLK (so that the clock choice is not affected by the
bootloader). The application startup code never switched to 8M clock,
which caused the default (XTAL/4) to be used as RTC_FAST_CLK. This had
caused a number of issues, such as touch pads not working in deep sleep.
Fixes https://github.com/espressif/esp-idf/issues/542.
Ref TW12053.
Split common SPI stuff out of master driver; add slave driver; add workaround for DMA issue.
This merge req mainly adds a slave device. In order to do this, the original master driver is refactored into common code shared by master and slave modes, and a slave driver is added.
The other things added are:
- Added a workaround for a 'feature' of the ESP32 silicon that can lock up the receive DMA channel in some situations. This can only be fixed by resetting *both* DMA channels. The workaround implemented makes sure that the reset only happens when both channels are idle
- Got rid of the automatic choice between register- and DMA-based transfers. The master (and slave) code will now always go for a DMA transfer if a DMA channel is given, and always go for register-based transfers if no DMA channel is given.
- Add in a bunch of fixes for outstanding Github issues.
See merge request !659
Add support 24, 32 bits
@jxmao optimize i2s_zero_buffer
@jxmao correct config support slave mode
@jxmao correct setup pin support tx/rx at the same time
Enhance pin power
@jxmao add dynamic change number of channels
remove nvs_init
remove start log and enhance power pin setup
using enum for i2s_channel and i2s_bits_per_sample, return ESP_ERR_INVALID_ARG when check params
validate i2s_bits_per_sample and channel
check tx & rx buffer before fill zero
remove checking channel as @jxmao suggest
limit dma buffer
modify i2s pin back to gpio mux before configure gpio matrix, resolve github issue #512
Add support 24, 32 bits
reduce push function
Modify sample can test with 24, 32-bits
Add i2s sample README
Fixed i2s_set_clk got reset sometime
can changes bit-wide while running
Fix sample rate calculation for DAC mode from @jeroen
modify example can change bits per sample every 5 seconds
cleanup
add comment for bytes_per_sample
update as @angus suggestions
Add i2s_set_clk api
I2S driver bug fixed as following log:
@jxmao optimize i2s_zero_buffer
@jxmao correct config support slave mode
@jxmao correct setup pin support tx/rx at the same time
Enhance pin power
@jxmao add dynamic change number of channels
remove nvs_init
remove start log and enhance power pin setup
using enum for i2s_channel and i2s_bits_per_sample, return ESP_ERR_INVALID_ARG when check params
validate i2s_bits_per_sample and channel
check tx & rx buffer before fill zero
remove checking channel as @jxmao suggest
limit dma buffer
modify i2s pin back to gpio mux before configure gpio matrix, resolve github issue #512
limit dma buffer to 4092
change gpio_matrix_*_check to inline function, remove some comments and rename test_i2s function to setup_triangle_sine_waves
for change commit title
esp32: Core dump sanity checks
Adds sanity checks when doing core dump to flash
- CRC for core dump flash partition config
- Tasks with corrupted TCBs are skipped
- Assertions to check that nothing is written beyond core dump flash partition
Ref TW11879
See merge request !686
- CRC for core dump flash partition config
- Tasks with corrupted TCBs are skipped
- Assertions to check that nothing is written beyond core dump flash partition
add support for 32k XTAL as RTC_SLOW_CLK source
- RTC_CNTL_SLOWCLK_FREQ define is removed; rtc_clk_slow_freq_get_hz
function can be used instead to get an approximate RTC_SLOW_CLK
frequency
- Clock calibration is performed at startup. The value is saved and used
for timekeeping and when entering deep sleep.
- When using the 32k XTAL, startup code will wait for the oscillator to
start up. This can be possibly optimized by starting a separate task
to wait for oscillator startup, and performing clock switch in that
task.
- Fix a bug that 32k XTAL would be disabled in rtc_clk_init.
- Fix a rounding error in rtc_clk_cal, which caused systematic frequency
error.
- Fix an overflow bug which caused rtc_clk_cal to timeout early if the
slow_clk_cycles argument would exceed certain value
- Improve 32k XTAL oscillator startup time by introducing bootstrapping
code, which uses internal pullup/pulldown resistors on 32K_N/32K_P
pins to set better initial conditions for the oscillator.
Ref TW11683.
Ref https://esp32.com/viewtopic.php?f=13&t=1570
Fixes https://github.com/espressif/esp-idf/issues/337.
See merge request !696
- RTC_CNTL_SLOWCLK_FREQ define is removed; rtc_clk_slow_freq_get_hz
function can be used instead to get an approximate RTC_SLOW_CLK
frequency
- Clock calibration is performed at startup. The value is saved and used
for timekeeping and when entering deep sleep.
- When using the 32k XTAL, startup code will wait for the oscillator to
start up. This can be possibly optimized by starting a separate task
to wait for oscillator startup, and performing clock switch in that
task.
- Fix a bug that 32k XTAL would be disabled in rtc_clk_init.
- Fix a rounding error in rtc_clk_cal, which caused systematic frequency
error.
- Fix an overflow bug which caused rtc_clk_cal to timeout early if the
slow_clk_cycles argument would exceed certain value
- Improve 32k XTAL oscillator startup time by introducing bootstrapping
code, which uses internal pullup/pulldown resistors on 32K_N/32K_P
pins to set better initial conditions for the oscillator.
1.change the rowdata to rodata;
2.change BT_ACL_CONNECTIONS to Maximum BT/BLE connection count.
3. change the comments of bt_target.h:505 from 40 to 5.
wear levelling
This MR adds wear levelling component. It presents an interface similar to the interface of spi_flash and esp_partition. Inside, it stores data inside a partition to in a way that reduces worst case number of erase cycles for any given sector.
Also included are APIs similar to the ones provided for SDMMC to mount FAT filesystem on top of the wear levelling partition. A simple example shows how this API can be used.
Ref TW10338.
See merge request !567
- reorder directories listed in COMPONENT_SRCDIRS so that
subdirectories precede parent directories
- don’t include PPP source directories if PPP support is not enabled
1. close classic bt, can save 233k code size;
2. close smp module, can save 136k code size;
3. close gattc module, can save 24k code size;
4. close gatts module, can save 16k code size;
4. close the bluedroid stack log, can save 120k code size.
XTAL frequency detection, support for selecting XTAL frequency
This MR adds more robust XTAL frequency detection code (which gets run in the bootloader) and an option to set XTAL frequency in Kconfig. By default we still use autodetection, since it is more reliable than the one used in ROM code.
This will help with issues about XTAL frequency detection in high ambient temperature conditions.
Ref TW12008
See merge request !694
sdmmc: handle card removal when CD is not used
When SD card is removed during transaction, SDMMC peripheral can report
a range of errors, such as timeouts, CRC errors, start/end bit errors.
Under normal conditions (card is inserted), SDMMC peripheral also generates
command done or data done interrupts. When the card is removed, such
interrupts may not be always generated.
This change fixes handling of timeout interrupts and SBE interrupts.
It also adds a one second timeout into the event processing loop. This
timeout allows applications to recover in cases when the SDMMC peripheral
doesn’t generate command/data done event on card removal.
Fixes TW11592.
See merge request !678
fat/sdmmc: unmount FATFS object on error
Failure to call f_mount(NULL,...) makes FATFS attempt to clean up the old
FS object upon next mount. If previous mount operation has failed, some
parts of FS object may not be fully initialized, which will cause errors
(such as attempting to delete a mutex which wasn’t allocated).
Fixes TW11594.
See merge request !679
ROM code already implements XTAL frequency detection, but it uses the 8M
clock before the clock tuning parameters are initialized. With the
zero clock tuning parameter, 8M clock has significant frequency deviation
at high temperatures, which can lead to erroneous detection of 40 MHz
crystal as a 26 MHz one.
This change adds XTAL frequency detection code to rtc_clk_init routine,
and detection is performed after the 8M clock tuning parameter as been
initialized.
lwip: fix tcp stable test abort issue
This MR covers following changes:
1. Modify dhcp server timer to 1 seconds
2. Enable ETHARP_TRUST_IP_MAC. Consider following scenario: we are in throughput test or traffic stability test, if this option is disabled, then every 5 minutes, the IP/MAC entry in arch cache is aged out, however, the traffic continuously send to lwip from application, because there is no IP/MAC entry in ARP cache, then the packets have to be buffered in ARP queue and a ARP request is triggered, but the ARP queue can only holds 3 packets, the later packets will be dropped, then if the traffic is big, a lot of packets will be dropped here before we get the right ARP response. For TCP, this will trigger re-transmit, it's intolerable for some application, such as real time audio, if re-transmit happen, then performance of voice will be impact. For UDP, sometimes it may also cause problem, such as DHCP, if here we failed to send the DHCP here, we has to wait the DHCP timeout etc... so this option is enabled here by default.
See merge request !681
esp32: update wifi lib for limitting dynamic wifi buffer
Add limit for all dynamic wifi ebuf to avoid wifi run out of memory in some extreme scanrio.
The default max allocated dynamic tx buffer is 32
The default max allocated dynamic rx buffer is 64, make default value is bigger because when all packets we received are small packets, e.g. the length is 64Bytes, then 64K can hold 1000 packets, so 64 maybe a good candidate default value, anyway the customer can configure it via menuconfig.
The default dynamic wifi internal long/long-long mgmt is 32, generally 32 is enough for mgmt packet (beacon/auth/assoc/probe/null etc). Generally when all the 32 mgmt buffer is run out of memory, it means internal wifi state machine may has problem, we need to debug it.
See merge request !683
There are some RODATAs of libphy.a that are called in ISR. So need
to put them into DRAM to avoid access them when R/W SPI flash. Due
to the RODATAs which are called in ISR haven't been picked out to
put into DRAM, put all of the RODATA of libphy.a into DRAM. This
will be optimized in the future.
soc: allow REG_SET_FIELD to be used for bit fields
- Fixes an issue with `rtc_clk_apll_enable`: https://esp32.com/viewtopic.php?f=13&t=1673
- Fixes `rtc_clk_fast_freq_set` function always selecting XTAL/4 as fast clock source.
- Fixes regression in deep sleep current (7uA instead of 5uA).
See merge request !674
rtc_clk_init: handle case when XTAL frequency has already been set
On first reset, ROM code writes the estimated XTAL frequency into
RTC_APB_FREQ_REG (aka STORE5). If the application doesn’t specify exact
XTAL frequency (which is always the case for now), rtc_clk_init will
guess what kind of XTAL is used (26M or 40M), based on the estimated
frequency. Later, detected frequency is written into RTC_XTAL_FREQ_REG
(aka STORE4).
When the application switches clock source to PLL, APB frequency changes
and RTC_APB_FREQ_REG is updated. If the application encounters an RTC
WDT reset, RTC_APB_FREQ_REG will not be updated prior to reset. Once the
application starts up again, it will attempt to auto-detect XTAL
frequency based on RTC_APB_FREQ_REG, which now has value of 80000000.
This will fail, and rtc_clk_xtal_freq_estimate will fall back to the
default value of 26 MHz. Due to an incorrect XTAL frequency, PLL
initialization will also take incorrect path, and PLL will run at a
different frequency. Depending on the application this may cause just
garbage output on UART or a crash (if WiFi is used).
This change checks if RTC_XTAL_FREQ_REG has already been set before trying
to estimate XTAL frequency based on the value of RTC_APB_FREQ_REG, and
uses RTC_XTAL_FREQ_REG value if it is valid.
Fixes TW11738.
See merge request !691
Base MAC address can be stored in default manufacture-defined or customer
pre-defined place in EFUSE and other place e.g. flash or EEPROM.
If choose to use base MAC address which is stored in other place, please
call esp_base_mac_addr_set_external() before initializing WiFi/BT/Ehternet.
On first reset, ROM code writes the estimated XTAL frequency into
RTC_APB_FREQ_REG (aka STORE5). If the application doesn’t specify exact
XTAL frequency (which is always the case for now), rtc_clk_init will
guess what kind of XTAL is used (26M or 40M), based on the estimated
frequency. Later, detected frequency is written into RTC_XTAL_FREQ_REG
(aka STORE4).
When the application switches clock source to PLL, APB frequency changes
and RTC_APB_FREQ_REG is updated. If the application encounters an RTC
WDT reset, RTC_APB_FREQ_REG will not be updated prior to reset. Once the
application starts up again, it will attempt to auto-detect XTAL
frequency based on RTC_APB_FREQ_REG, which now has value of 80000000.
This will fail, and rtc_clk_xtal_freq_estimate will fall back to the
default value of 26 MHz. Due to an incorrect XTAL frequency, PLL
initialization will also take incorrect path, and PLL will run at a
different frequency. Depending on the application this may cause just
garbage output on UART or a crash (if WiFi is used).
SPI transfer length is bits, not bytes, so the error should indicate bits. Also, there are separate lengths for rx and
tx (confusingly named rxlength and length... if rxlength is 0, length is used). The code checks the tx length for the
rx, so it never validates rxlength.
Originally contributed as part of #511https://github.com/espressif/esp-idf/pull/511
Since mbedtls_net_errno is reset by fcntl, it is reset after calling
net_would_block, so the call to mbedtls_net_errno in mbedtls_net_recv
and mbedtls_net_send will always get back 0. This change propagates
the value returned by mbedtls_net_errno up through net_would_block,
to allow the correct error value to be used and avoid a redundant
call to mbedtls_net_errno.
Merges PR #511https://github.com/espressif/esp-idf/pull/511
Failure to call f_mount(NULL,...) makes FATFS attempt to clean up the old
FS object upon next mount. If previous mount operation has failed, some
parts of FS object may not be fully initialized, which will cause errors
(such as attempting to delete a mutex which wasn’t allocated).
When SD card is removed during transaction, SDMMC peripheral can report
a range of errors, such as timeouts, CRC errors, start/end bit errors.
Under normal conditions (card is inserted), SDMMC peripheral also generates
command done or data done interrupts. When the card is removed, such
interrupts may not be always generated.
This change fixes handling of timeout interrupts and SBE interrupts.
It also adds a one second timeout into the event processing loop. This
timeout allows applications to recover in cases when the SDMMC peripheral
doesn’t generate command/data done event on card removal.
Remove ESP_EARLY_LOGI before bss is initialized; it crashes the CPU
There's an ESP_EARLY_LOGI line that can get called before the BSS is initialized; the early logging code doesn't cope well with that: it checks if FreeRTOS is up, but the variables it uses for that contains garbage because it isn't cleared yet, giving the wrong result. The logging code then tries to set a mux, crashing the entire system. This patch removes the log line and adds a warning at the BSS initialization line not to do anything complex before that point.
Fixes https://github.com/espressif/esp-idf/issues/523
See merge request !671
- Implements application tracing module which allows to send arbitrary
data to host over JTAG. This feature is useful for analyzing
program modules behavior, dumping run-time application data etc.
- Implements printf-like logging functions on top of apptrace module.
This feature is a kind of semihosted printf functionality with lower
overhead and impact on system behaviour as compared to standard printf.
component/bt: transfer bluedroid timer events to be handled by BTC task
NVS operation can take long time for timer task to handle. Transfer the alarm event to be handled by BTC task.
See merge request !670
Detect invalid cache access
This MR adds always-on feature which detects cache invalid access and triggers panic handler when invalid access interrupt is raised.
See merge request !660
Confusion here is that original ROM has two functions:
* SPIReadModeCnfig() - sets mode, calls enable_qio_mode/disable_qio_mode
* SPIMasterReadModeCnfig() - As above, but doesn't set QIO mode in status register
However we never want to use the ROM method to set/clear QIO mode flag, as not all flash chips work this way. Instead we
do it in flash_qio_mode.c in bootloader.
So in both cases (ROM or "patched ROM") we now call SPIMasterReadModeCnfig(), which is now named
esp_rom_spiflash_config_readmode().
Fix uart tx function block issue
To enable tx empty interrupt each time the tx ringbuffer get filled, so that tx function will not block if tx data length is larger than tx ringbuffer size.
Reported from customer of Audio team.
See merge request !658
give the AP and STA netifs different names for ease of debugging lwip
Both AP and STA netifs used to be called "en". This changes the name to "st" for STA and "ap" for AP.
Ref https://github.com/espressif/esp-idf/pull/456.
See merge request !653
Feature/btdm avrc
The source branch "feature/btdm_avrc" includes classic Bluetooth profiles A2DP(sink role) and AVRCP(controller role);
Menuconfig options to control whether to enable classic BT is added.
See merge request !591
Enable checks for encrypted flash in OTA
Even if firmware is compiled without CONFIG_FLASH_ENCRYPTION_ENABLED.
Rationale: CONFIG_FLASH_ENCRYPTION_ENABLED controls whether boot loader generates keys for encryption or not, but flash encryption can be configured externally. With this change, it's possible to have boot loader not generate keys but still have encryption working.
Also fix use of it->part
Ref. https://github.com/espressif/esp-idf/pull/453
See merge request !647
To enable tx empty interrupt each time the tx ringbuffer get filled, so that tx function will not block if tx data length is larger than tx ringbuffer size.
Reported from customer of Audio team.
bt component: Fix memory leak while using gatt server
- fix memory leak while creating attribute table
- fix memory leak while deleting service
See merge request !656
Introduce soc component, add source of rtc_clk and rtc_pm libraries
This MR adds parts of the RTC library source code (initialization, clock selection functions, sleep functions). WiFi-related power management functions are kept inside the precompiled library. Most of RTC library APIs have been renamed.
Default CPU frequency option in Kconfig is set to 160MHz, pending qualification of 240MHz mode at high temperatures.
Register header files are moved into the new soc component, which will contain chip-specific header files and low-level non-RTOS-aware APIs (such as rtc_ APIs). Some of the files from ESP32 component were also moved: cpu_util.c, brownout.c, and the corresponding header files. Further refactoring of ESP32 component into more meaningful layers (chip-specific low level functions; chip-specific RTOS aware functions; framework-specific RTOS-related functions) will be done in future MRs.
See merge request !633
Bugfix/flash busy check wait spi idle
This branch moves some ROM SPI flash driver to IDF to fix bug in Wait_SPI_Idle() function.
Also it applies code style rules of IDF to integrated ROM driver sources.
See merge request !584
Even if firmware is compiled without CONFIG_FLASH_ENCRYPTION_ENABLED
Rayionale: CONFIG_FLASH_ENCRYPTION_ENABLED controls whether boot loader
generates keys for encryption or not, but flash encryption can be
configured externally. With this change, it's possible to have boot
loader not generate keys but still have encryption working.
Also fix use of it->part
1) fixed SPI_read_status: added check for flash busy flag in matrix mode
2) fixed SPI_page_program: enable write before writing data to SPI FIFO
3) SPI flash ROM funcs replacement is controlled via menuconfig option
CI: add reset between running each unit test cases
Unit test is designed to detect bug **within** each test case. Therefore we'll reset between each case to provide a clean context. We will later add stress cases to run unit test cases together to detect potential bugs.
See merge request !636
esp32: initialize cross-core interrupt in single core mode
The software interrupt originally used as the cross-core interrupt is
now also used to yield from a FreeRTOS critical section; therefore it
must be initialized for single core mode as well.
Fixes https://github.com/espressif/esp-idf/issues/496
See merge request !640
fix warnings generated by ESP_ERROR_CHECK(variable) in release builds
This uses the same pattern as “assert” in release builds to silence the
warning. At the same time, we make sure that if a statement is wrapped
into ESP_ERROR_CHECK, it is executed in release build as well.
Fixes https://github.com/espressif/esp-idf/issues/497
See merge request !641
This uses the same pattern as “assert” in release builds to silence the
warning. At the same time, we make sure that if a statement is wrapped
into ESP_ERROR_CHECK, it is executed in release build as well.
The software interrupt originally used as the cross-core interrupt is
now also used to yield from a FreeRTOS critical section; therefore it
must be initialized for single core mode as well.
Fixes https://github.com/espressif/esp-idf/issues/496
esp32: RWDT is used to reboot system in case of panic handler crash
This branch uses RWDT to reboot system in case of panic handler crash.
See merge request !625
Feature/btdm uart hci
1. support UART HCI, devolper need not to make a bridge between VHCI and UART.
2. fix bug of rand/srand called in ISR.
3. fix bug of BLE rx packets may cause assert.
See merge request !626
component/bt : modify alarm APIs to be safely accessible from multiple tasks
Improve the osi_alarm module to make the alarm APIs become thread safe.
See merge request !570
1. support UART HCI, devolper need not to make a bridge between VHCI and UART.
2. fix bug of rand/srand called in ISR.
3. fix bug of BLE rx packets may cause assert.
lwip: implement lwip critical session with mutex
Currently lwip critical session is based on interrupt, now replace it with mutex
See merge request !595
spi_flash: fix race condition in s_flash_op_complete access
Flash operation complete flag was cleared by the CPU initiating flash operation. If the other core was running an ISR, then IPC task could be late to enter the loop to check `s_flash_op_complete` by the time next flash operation started. This would cause a deadlock, as the IPC task would still be waiting for `s_flash_op_complete` to be set (which was already cleared by the next flash operation), while the flash operation task would be blocked waiting for IPC task to set `s_flash_op_can_start`.
If the flag is cleared on the CPU waiting on this flag, then the race condition can not happen.
See merge request !615
Fix timing adjustment needed for higher speeds of SPI master bus.
Ref https://github.com/espressif/esp-idf/issues/363 . It was found out the master SPI driver didn't exactly calculate the delay compensation needed, breaking 20 and 26MHz full-duplex mode. This fixes these use cases. We also found out 40MHz full-duplex routed over the GPIO matrix does not work because of a hardware quirk; this MR adds a check/error for that case until we find a workaround.
See merge request !547
If static tx buffer is selected, WiFi tx buffers are allocated when WiFi is initialized and released
when WiFi is de-initialized. If dynamic tx buffer is selected, WiFi tx buffer is allocated when tx
data is delivered from LWIP to WiFi and released when tx data is sent out by WiFi.
The size of each static tx buffers is fixed to about 1.6KB and the size of dynamic tx buffers is
depend on the length of the data delivered from LWIP.
If PSRAM is enabled, "STATIC" should be selected to guarantee enough WiFi tx buffers.
If PSRAM is disabled, "DYNAMIC" should be selected to improve the utilization of RAM.
Fix finding location of ISR stack space for CPU1
Up to now, the CPU1 interrupts erroneously used the area *after* the ISR stack region, leading to bugs in BT Classic. This fixes that.
See merge request !618
Flash operation complete flag was cleared by the core initiating flash
operation. If the other core was running an ISR, then IPC task could
be late to enter the loop to check s_flash_op_complete by the time next
flash operation started. If the flag is cleared on the CPU waiting on
this flag, then the race condition can not happen.
ULP coprocessor toolchain integration
- build system support for ULP coprocessor toolchain
- documentation for ULP coprocessor instruction set
- documentation for ULP code execution flow, loading programs, exchanging data
- example: counting pulses using ULP
See merge request !394
Reset WIFI mac when wifi start and update wifi lib
1. reset wifi mac when wifi start
2. roll back rx hung workaround for beacon timeout
3. fix amsdu ap interface wrong issue
4. fix amsdu header parse error
5. fix amsdu flag wrong issue
6. PHY: V350, fix BT rssi bug
7. RTC: V225, fix bt will be not work when wifi is reset
See merge request !606
SPI flash operations lock for shorter periods
Based on bug report here:
https://esp32.com/viewtopic.php?f=13&t=1489&p=6816#p6773
Long SPI flash erase (and possibly write/read) cycles block all tasks on both CPUs for an extended period, and can lead to WiFi dissassociation (and general priority inversion.)
This MR inserts preemption breaks into large operations (all erases, writes every 8KB, reads every 16KB).
Overhead of a single spi_flash_guart_start()/spi_flash_guard_end() cycle measured at approx 67us (assuming no preemption.)
See merge request !600
bugfix: ESP32 Core Dump reported issues
This MR fixes the following issues:
1. fixed path to esptool when there is no compiled python module for it
2. GDB inernal failure handling was added
See merge request !599
Error handling in NVS initialization
Previously nvs_flash_init worked under an assumption that there should always be at least one free page available. This is true during normal operation, but in some cases (such as when changing application partition table from a non-OTA to an OTA one), NVS partition may get truncated, which will cause empty pages to be lost.
This MR adds error checks for this condition, and updates code which calls `nvs_flash_init` to check for the return code.
For most examples, a simple `ESP_ERROR_CHECK` is added around `nvs_flash_init`. For NVS examples and the OTA example, more robust error handling is added.
This change also removes nvs_flash_init calls from examples which don't use NVS.
See merge request !582
idf_monitor: Small fixes (baud rate, EOL, /dev/tty.X on macOS, Ctrl-T on failure)
* "make monitor" now passed the configured baud rate.
Closes#436https://github.com/espressif/esp-idf/issues/436
* Pass toolchain prefix from sdkconfig into monitor tool
* Allow setting EOL in idf_monitor.py, use CRLF by default
* Detect if /dev/tty.X is used on macOS, warn and replace with /dev/cu.X
* If a build fails or gdb exits, ignore Ctrl-T (allowing Ctrl-T Ctrl-A/F to be same key sequence everywhere)
* Add a note about winpty on Windows.
Ref 02fdf8271d (commitcomment-21369196)
* Fix problems with Console.cancel() not existing in older pyserial
* Print more user-friendly symbols for "start of iram" and "start of flash"
See merge request !594
1. reset wifi mac when wifi start
2. roll back rx hung workaround for beacon timeout
3. fix amsdu ap interface wrong issue
4. fix amsdu header parse error
5. fix amsdu flag wrong issue
6. PHY: V350, fix BT rssi bug
7. RTC: V225, fix bt will be not work when wifi is reset
* Erase range operations allow preemption after each block or sector.
* Write operations allow preemption every 8KB of data.
* Reado operations allow preemption every 16KB of data.
This is to avoid confusion when idf_monitor prints the first symbol in each section, ie "WindowOverflow4" or similar,
when bootloader prints the section mapping address.
Closes#447https://github.com/espressif/esp-idf/issues/447
* "make monitor" not passed the configured baud rate
Closes#436https://github.com/espressif/esp-idf/issues/436
* Pass toolchain prefix from sdkconfig into monitor tool
* Allow setting EOL in idf_monitor.py, use CRLF by default
* Detect if /dev/tty.X is used on macOS, warn and replace with /dev/cu.X
* If a build fails or gdb exits, ignore Ctrl-T (allowing Ctrl-T Ctrl-A/F to be same key sequence everywhere)
* Add a note about winpty on Windows
Ref 02fdf8271d (commitcomment-21369196)
modify touch pad read function
The touch pad read function taks too much time within spin lock waiting for the "done bit". (about 7.6ms as we tested)
So we try to use a mutex on the touch read function and any other functions might change the "done bit".
See merge request !543
This issue is reported from https://github.com/espressif/esp-idf/issues/304.
We found that when we operate the hw command registers in I2C struct, sometimes the behaviour would be different in DEBUG/RELEASE optimisation level:
The code looks like this:
I2C[i2c_num]->command[p_i2c->cmd_idx].byte_num -= 0;
In DEBUG configuration:
I2C[i2c_num]->command[p_i2c->cmd_idx].byte_num -= 0;
400f3ab0: 3388 l32i.n a8, a3, 12
400f3ab2: 14c882 addi a8, a8, 20
400f3ab5: a08840 addx4 a8, a8, a4
400f3ab8: 0020c0 memw
400f3abb: 2898 l32i.n a9, a8, 8
400f3abd: 0020c0 memw
400f3ac0: 28b8 l32i.n a11, a8, 8
400f3ac2: 74a090 extui a10, a9, 0, 8
400f3ac5: 00af92 movi a9, 0xffffff00
400f3ac8: 109b90 and a9, a11, a9
400f3acb: 2099a0 or a9, a9, a10
400f3ace: 0020c0 memw
400f3ad1: 2899 s32i.n a9, a8, 8
In RELEASE configuration:
I2C[i2c_num]->command[p_i2c->cmd_idx].byte_num -= 0;
400f2ba2: 580572 l8ui a7, a5, 88
400f2ba5: 747070 extui a7, a7, 0, 8
400f2ba8: 0020c0 memw
400f2bab: 584572 s8i a7, a5, 88
Looks like the compiler will make it a 8bit operation after optimisation.
But the register value changes from 0x901 to 0x101.
After this 8-bit optimisation, the 11th bit changed from 1 to zero, which caused this error.
We are still trying to find out why that happens, because there might be some risk when operating the register struct.
This is a workaround to avoid "-=" operation on I2C register struct fields.
1. Add low speed channels for LEDC module.
2. Improve fade object allocate mechanism.
3. Improve ledc example, add 2 low speed channels in example.
4. Remove debug code
5. Improve the register bit field name of slow clock.
esp32: update wifi lib for some bugfix/features
1. add options to disable nvs
2. add station keepalive with softap
3. fix beacon rx start time not accurate issue
4. set wifi rx desc/buffer boundary check to internal memory boundary
See merge request !578
nvs_flash_init may return an error code in some cases, and applications
should check this error code (or at least assert on it being ESP_OK, to
make potential issues more immediately obvious).
This change modifies all the examples which use NVS to check the error
code. Most examples get a simple ESP_ERROR_CHECK assert, while NVS
examples, OTA example, and NVS unit tests get a more verbose check which
may be used in real applications.
Expand 'make monitor' support
New 'make monitor' idf_monitor tool for better monitor output. Running 'make monitor' will now:
* Automatically look up code addresses via addr2line and print function, source file, line number in terminal.
* Can reset the ESP32 by typing Ctrl-T Ctrl-R.
* Can run "make flash" by typing Ctrl-T Ctrl-F.
* Can run "make app-flash" by typing Ctrl-T Ctrl-A.
* If gdb stub starts, monitor will automatically run gdb and connect. When gdb exits, ESP32 resets and monitor resumes.
* Exit is still Ctrl-[
Have some more features I'd like to add (log output to file, crash dump support) but I think this is at the point of being useful.
See merge request !565
This change adds a check for the free page count to nvs_flash_init.
Under normal operation, NVS keeps at least one free page available,
except for transient states such as freeing up new page. Due to external
factors (such as NVS partition size reduction) this free page could be
lost, making NVS operation impossible. Previously this would cause an
error when performing any nvs_set operation or opening a new namespace.
With this change, an error is returned from nvs_flash_init to indicate
that NVS partition is in such a state.
make: don’t override TEST_COMPONENTS
When idf_monitor is launched from make, it gets modified `TEST_COMPONENTS`
variable which contains full paths to the test components instead of the
names. This causes `TEST_COMPONENT_PATHS` to be empty and the unit test
app gets built without any test components.
This change introduces an internal `TEST_COMPONENTS_LIST` variable which
gets set either from `COMPONENTS` if `TESTS_ALL` is 1, or from
`TEST_COMOPONENTS` otherwise.
Bootloader makefile is also fixed to avoid propagating `TESTS_ALL` to the
bootloader build step.
See merge request !569
bug fix: fix uart data bug when stop-bit is set as 2-bit mode
This is a workaround for a hardware bug.
When we want to use 2-stop-bit mode, we need to set stop-bit-1 and set dl1_en in rs485 register.
See merge request !544
1. add options to disable nvs
2. add station keepalive with softap
3. fix beacon rx start time not accurate issue
4. set wifi rx desc/buffer boundary check to internal memory boundary
The touch pad read function taks too much time within spin lock waiting for the "done bit". (about 7.6ms as we tested)
So we try to use a mutex on the touch read function and any other functions might change the "done bit".
When idf_monitor is launched from make, it gets modified TEST_COMPONENTS
variable which contains full paths to the test components instead of the
names. This causes TEST_COMPONENT_PATHS to be empty and the unit test
app gets built without any test components.
This change introduces an internal TEST_COMPONENTS_LIST variable which
gets set either from $(COMPONENTS) if TESTS_ALL is 1, and from
TEST_COMOPONENTS otherwise.
Bootloader makefile is also fixed to avoid propagating TESTS_ALL to the
bootloader build step.
bt component: fix bluetooth gatt packets process bugs
1. Add process of prepare write request packets
2. Add process of execute write request packets
3. Add process of reliable write request packets
4. Fix bug of processing read blob request packets
5. Fix bug of processing write request packets
6. Optimize error check and process in stack
See merge request !558
add wakeup from touch sensor, and deep sleep example
- add new deep sleep wakeup mode
- change documentation to explain incompatibilities between different wakeup mode, add error checks
- add new ULP instructions necessary for ULP wakeup scenario
- fix issues with I_WR_REG, I_SLEEP, I_END instructions
- add deep sleep example, illustrating the use of timer, gpio, touch, and ULP wakeup triggers
See merge request !461
add extra check before bluedroid init and disable
add extra check before bluedroid init and disable to avoid the mixed call cause unexpected errors.
See merge request !553
component/bt: optimize stack size of Bluetooth Tasks and make them be configurab…
Bluetooth tasks' stack size are optimized and can be configured by the CONFIG_NEWLIB_NANO_FORMAT option.
See merge request !559
esptool version bump and new "espefuse.py set_flash voltage" command
* New "espefuse.py set_flash_voltage" command to easily set a fix
VDD_SDIO regulator voltage (1.8V, 3.3V or disabled).
* Fixes bugs when flashing files with non-4-byte aligned lengths
(doesn't effect esp-idf image files)
* esptool README improvements
* Detect overlapping files in write_flash
* read_mac now works correctly on ESP32
* Integrates reset fix for older dev boards (formerly the "Windows ESP32R0 reset workaround")
See merge request !481
Change max number of open sockets
Change max number of open sockets from 16 to 32 because of MFI project need support 21 open sockets at least.
See merge request !532
1. Add process of prepare write request packets
2. Add process of execute write request packets
3. Add process of reliable write request packets
4. Fix bug of processing read blob request packets
5. Fix bug of processing write request packets
6. Optimize error check and process in stack
Fix partition- and mmap-related issues
- Fix unit tests failing to start up due to a mismatch between sdkconfig flash size and size required by partition table.
- Fix a bug that partition APIs loaded the partition table in reverse order. As such, `esp_partition_next` and `esp_partition_find_first` did not work as expected. Add a test.
- Update the workaround for stale cache reads issue: do Cache_Flush for non-encrypted flash as well. Add a test.
See merge request !555
The issue that cache entries are not invalidated correctly sometimes
can also be reproduced for non-encrypted flash as well.
This change updates the workaround to do Cache_Flush, enabling it for
non-encrypted flash, and adds a unit test.
- change order of assert arguments to (expected, actual)
- set expected partition count to 3 to match the new partition table
- use the new get_test_partition facility
- check that partitions are listed in correct order
- remove leftover debugging printfs
Originally marked "Reset with ESP32R0 Windows workaround", but proven to be
necessary on some other platforms as well. This is now integrated into the
default esptool.py reset behaviour.
Closes#305https://github.com/espressif/esp-idf/issues/305
* New "espefuse.py set_flash_voltage" command to easily set a fix
VDD_SDIO regulator voltage (1.8V, 3.3V or disabled).
* Fixes bugs when flashing files with non-4-byte aligned lengths
(doesn't effect esp-idf image files)
* README improvements
Allow separate ethernet & wifi configuration
If only 1/2 of ethernet & WiFi are enabled in config, the other interface is no longer linked into the firmware.
* Fixes bug where enabling Ethernet but not WiFi would fail to compile.
* Also means that enabling WiFi but not Ethernet no longer links some unused ethernet interface functions.
See merge request !525
FreeRTOS: Fix cross-core event group sync
As above
Also includes fixes which allowed removing some semi-hacky bits from the event group unit tests - specifically, higher priority tasks will always be started immediately even if they run on the opposite core.
See merge request !535
FATFS enable support for multiple drives
Current implementation has drive numbers and paths hardcoded to support
only one FATFS drive. Arduino has it's own SPI driver to allow
compatibility and flexibility. With the MR it is possible to have up to
```_VOLUMES``` drives connected (SPI, SDMMC and others) at the same
time and accessed through VFS
See merge request !478
freertos kconfig: Add max task length name, move task stack overflow watchpoint
* Allow setting task name length via kconfig
* Move task stack overflow watchpoint out of internals debugging submenu, place next to other stack overflow checks.
* Thread local pointer feature should depend on Ethernet or WiFi
See merge request !531
Partition/SPI/OTA docs & OTA new functionality
* Update partition, SPI flash & OTA docs to reflect functionality changes
* Refactor OTA implementation to perform checks mentioned in API doc
* Add new functions to OTA API: esp_ota_get_running_partition() & esp_ota_get_next_update_partition() functions
* Add spi_flash_cache2phys() & spi_flash_phys2cache() functions to support esp_ota_get_running_partition()
See merge request !513
Feature/add user set mac
1. Add menuconfig for user to set mac address of wifi, bt and ethernet.
2. Add the number of MAC address generated from efuse for user to choose.
3. Add MAC address derive method.
See merge request !542
esp32: Fix hardware rng after esp_wifi_stop (second implementation)
Ensures hardware RNG remains enabled at all times.
Reworked version of !534
See merge request !536
lwip: modify dhcp timer granularity from 60s to 1s
Current DHCP granularity is 60 seconds, it's not accurate, it can cause DHCP release/rebind/renew timer
timeout at the same time, also it may renew/rebind/release at wrong time, thus cause problem.
1. RTC V214: modify APLL function for the chip of ECO version.
2. Add API phy_close_rf() and use it in esp_phy_deinit() instead of pm_close_rf().
3. RTC V213: fix BT will not work when BT-init is called more than once.
vfs_fat_sdmmc: if card init fails, fail cleanly
This fixes the issue with sdmmc_host not returned to clean state after a failed attempt to mount the card, with no SD card in the slot.
See merge request !527
component/bt : add adv/scan start complete event
1. indicate adv/scan start complete success or failed
2. controller do limit of adv/scan concurrence, so add some codes to report adv/scan start failed or not.
See merge request !524
component/bt:fixed the write ccc crash bug error
fix the gatt server write ccc lead to the system crash if not initialize the ccc value.
See merge request !515
Optimize or release memory in bluetooth
1. add option to release about 30K from BT if BLE only
2. later BT/BLE will be separated by BT/BLE macro, but this option should use when user make sure that in BLE only mode.
See merge request !520
1. indicate adv/scan start complete success or failed
2. controller do limit of adv/scan concurrence, so add some codes to report adv/scan start failed or not.
The root cause is the bug in bluetooth controller, in which the HCI_SNIFF_MODE command is sent to controller and at the same time the controller has received same request from remote device.
For now change the time-out period of local device to enter the SNIFF mode.
Fix a scheduling bug
Fixes:
- Trivial bug where in some special cases a task could be started on the wrong core (and would run there for max 1 tick)
- More major bug causing a yield to be done with a mux held.
See merge request !523
Fix SPI master transmit length
Tx/Rx length fix from https://github.com/espressif/esp-idf/pull/336
I also added an extra commit in to make use of a define instead of a literal, plus fix a (harmless) off-by-one condition.
See merge request !521
This fixes incorrect descriptions of I_END/I_SLEEP instructions and
changes the definition of I_END. New instruction, I_WAKE, is added,
which wakes up the SoC. Macro for ADC instruction is defined, and new
tests are added.
This change adds esp_deep_sleep_get_wakeup_cause, which returns the
source which has caused wakeup from deep sleep.
Similar to esp_deep_sleep_get_ext1_wakeup_status, a function is added
to check touch pad wakeup status: esp_deep_sleep_get_touchpad_wakeup_status.
This function returns the touch pad which has caused wakeup.
ULP and touch FSMs in ESP32 revisions 0 and 1 do not operate correctly
if RTC_PERIPH power domain is force powered on (ESP_PD_OPTION_ON).
Both ULP and touch still work, but clock frequency of the ULP may be
incorrect and touch values may be off by considerable amount. As such,
when these wakeup modes are used, RTC_PERIPH power domain has to be set
to ESP_PD_OPTION_AUTO (or, in the current implementation,
ESP_PD_OPTION_OFF — though this will change in the future when _OFF will
actually *force* the power domain to be powered off).
Because EXT0 wakeup source requires RTC_PERIPH to be powered ON, mark
ULP and touch wakeup sources as incompatible with EXT0. Workaround for
this is to use EXT1 wakeup source instead, which offers similar or
better functions without having to keep RTC_PERIPH powered on.
- I_RD_REG used the wrong union member (.rd_reg) due to a copy-paste
mistake
- Peripheral register address in bits[7:0] should be given in words,
not in bytes
Fixes https://github.com/espressif/esp-idf/issues/297
Deep sleep fixes
This change fixes extra 24 uA current consumption in deep sleep mode (https://esp32.com/viewtopic.php?f=2&t=1133).
Recent update to libphy/librtc caused another problem that WiFi related parts of RTC are no longer disabled by RTC sleep functions. This means that if WiFi is not disabled by the application before entering deep sleep, extra ~200uA of current would be consumed. This is fixed, and documentation for esp_deep_sleep and SNTP example are updated to mention that applications should take care of disabling WiFi and BT before going into the deep sleep mode.
See merge request !516
spi_flash: fix protection issues
This MR fixes the two spi_flash related issues:
- esp_intr_noniram_{disable,enable} not being protected by spi_flash_op_{lock,unlock} in single core mode. This caused a safety assert to be triggered in esp_intr_noniram_disable.
- spi_flash_unlock not being protected by spi_flash_guard_{start,end}. This caused a conflict between SPI0 and SPI1 controllers when accessing SPI flash, manifesting in cache data corruption and IllegalInstruction exceptions, for some flash chips.
See merge request !522
spi_flash_unlock was missing spi_flash_guard_start, which caused cache
to be enabled during unlock operation, causing hard-to-trace crashes
and cache data corruption.
MR !441 (7c155ab) has fixed issue with esp_intr_noniram_{disable,enable}
calls not being properly protected by spi_flash_op_{lock,unlock}.
Unit test was added, but the unit test environment tests only dual-core
config. Similar issue was present in the code path for the single-core
config, where esp_intr_noniram_{disable,enable} calls were unprotected.
This change fixes the protection issue and updates the unit test to
run properly in single core config as well.
The issue with running unit tests for single core config will be
addressed in a separate MR.
In case WiFi/BT stack has been enabled but wasn’t disabled, some RTC
bits may be left enabled, causing increased current consumption.
This change returns some of the bits back to their default values.
Bootloader enables SAR ADC in test mode to get some entropy for the RNG.
The bits which control the ADC test mux were not disabled, which caused
extra ~24uA current to be drawn from VRTC, increasing deep sleep current
consumption. This change disables relevant test mode bits in
bootloader_random_disable.
1. add new APIs bt controller enable/disab/deinit
2. make bt controller work need to call two APIs of esp_bt_controller_init and enable
3. modify phy init to make mac reset once
1. add a macro in menuconfig for users to choose whether store phy calibration data into NVS or not.
2. rename some disable phy and rf APIs so that existing code which calls old APIS will fail to compile.
1. Add disable PHY and RF when WiFi and BT are both disabled(including call sniffer disable API).
2. Do not init PHY and RF when cpu start. Init PHY and RF when call Wifi or BT start APIs(including sniffer enable API).
3. Add a temporary lib: librtc_clk.a and will delete it when CPU frequency switching function is done.
4. Add an function to get OS tick rate.
5. Do not put the whole pp.a in iram0, only put lmac.o, ieee80211_misc.o, ets_time.o and wdev.o in iram0.
This connection error caused by iPhone, it think that TX data length must large than 27 when slave support EXTEND_DATA_LENGTH. But this should be allow. Besides, the problem cannot be found on higher version of Iphone7, apple seemed to have fixed it.
Actually maybe other BLE device have the same problem.
Docs: Document flash encryption disable steps, clean up flash encryption & secure boot docs
Generate clean up of flash encryption & secure boot docs
Including steps for disabling flash encryption (for people who accidentally enable it).
See merge request !500
phy_init: don’t rewrite valid calibration data
In the default PHY init routine, calibration data is loaded from NVS.
Most of the time the incremental changes to calibration will be fairly
small, so we don’t need to rewrite the existing calibration data stored
in the NVS.
Possible enhancement to be done in the future: expose a function in PHY
library to tell how big was the change in calibration data. If the
change was significant, then calibration data stored in NVS should be
updated.
See merge request !487
freertos: fix protection issue in freertos queue event list
When functions in queue.c calls listLIST_IS_EMPTY() to check queue event list, the queue list is
protected by queue mutex, on the other hand, when xTaskIncrementTick() modify the queue list, the
queue list is protected by xTaskQueueMutex, this may cause xTaskRemoveFromEventList operate on
the empty queue list and cause problem.
This change works around the problem by reducing the window where the race condition can happen.
See merge request !465
Also add steps to disable flash encryption, as some people seem to
accidentally enable it.
Explicitly mark the flash encryption and secure boot as "READ DOCS
FIRST" in menuconfig.
esp32: update wifi lib for some fixes and optimizations
1. Reduce the default static rx buffer size from 25 to 10
2. Adjust ampdu interrupt size to 3, namely, raise 1 interrupt per 3-mpdu
3. Make a copy for all received packets, including AMSDU/AMPDU/MPDU
4. Fix softap mis-forward issue
5. Fix pp q full issue
6. Fix sniffer copy wrong content issue
See merge request !491
When functions in queue.c calls listLIST_IS_EMPTY() to check queue event list, the queue list is
protected by queue mutex, on the other hand, when xTaskIncrementTick() modify the queue list, the
queue list is protected by xTaskQueueMutex, this may cause xTaskRemoveFromEventList operate on
the empty queue list and cause problem. This commit is to fix this bug.
may cause
1. Reduce the default static rx buffer size from 25 to 10
2. Adjust ampdu interrupt size to 3, namely, raise 1 interrupt per 3-mpdu
3. Make a copy for all received packets, including AMSDU/AMPDU/MPDU
4. Fix softap mis-forward issue
5. Fix pp q full issue
6. Fix sniffer copy wrong content issue
Fix interrupting task on other CPU that has lower prio than current task on current CPU
Fix for a very subtle bug introduced somewhere in december. This bug would cause a cross-core interrupt to only be sent if the activated task has a higher priority than the task currently running on *this* cpu, instead of on the other CPU.
See merge request !475
In the default PHY init routine, calibration data is loaded from NVS.
Most of the time the incremental changes to calibration will be fairly
small, so we don’t need to rewrite the existing calibration data stored
in the NVS.
Possible enhancement to be done in the future: expose a function in PHY
library to tell how big was the change in calibration data. If the
change was significant, then calibration data stored in NVS should be
updated.
esp32: Fixes watchdog problem when printing core dump to uart
1) Fixes watchdog problem when printing core dump to uart
2) Also fixes generation of core dumps when flash cache is disabled
See merge request !472
Current implementation has drive numbers and paths hardcoded to support
only one FATFS drive. Arduino has it's own SPI driver to allow
compatibility and flexibility. With the MR it is possible to have up to
```_VOLUMES``` drives connected (SPI, SDMMC and others) at the same
time and accessed through VFS
components/openssl: refactor openssl debugging and assert function
1. add openssl option at menuconfig
2. remove SSL_ERR to reduce complexity
3. add more functions about debugging and assert
According these, our coders and customers may use and debug the OpenSSL code easily.
See merge request !400
Use PART_FLAG_ENCRYPTED value in gen_esp32part.py
Currently paritions marked as encrypted by gen_esp32part.py are not
recognized as such and encrypted writes don't work.
This is part of espressif/esp-idf#253
Merges Pull Request #293https://github.com/espressif/esp-idf/pull/293
See merge request !470
Add missing variable initialisation to make SPI work for multiple CS
Ref https://github.com/espressif/esp-idf/pull/277
From PR: "I am not especially familiar with this platform or with esp-idf -- so review with care.
The spi-master driver would not work for me when the number of devices on a bus exceeded 1 (caused device hang). I believe this is because cur_cs is not properly set (anywhere), and yet is used. This is likely just not noticed because 0 is presumably the correct value when there's only 1 device (and I'm guessing multi-device setup is not tested as thoroughly).
Simply setting cur_cs to the correct slot value resolves the problem and multiple devices on a single bus behave correctly in my test environment."
Looks like a small oversight on my side.
See merge request !468
1. fix ampdu<->mpdu<->ampdu switch may cause rx slow issue by put mpdu into ampdu reorder queue
2. fix each ac first sending always fail issue by adding retry
Seems doing certain kinds of short reads while flash encryption is
enabled will return stale data. This fixes it, but is probably a
little heavy-handed performance wise.
Verify 0xE9 magic byte on first write, verify entire image before
switching.
Enable verification for secure boot signature (was using invalid ifdef
guard)
Currently paritions marked as encrypted by gen_esp32part.py are not
recognized as such and encrypted writes don't work.
This is part of espressif/esp-idf#253
lwip: optimize the dhcp client
1. modify the discover retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s.
2. add DHCP_DOES_ARP_CHECK to menuconfig for users to specify if do a ARP check on the offered address.
If enable, one more second will be taken.
See merge request !459
1. modify the discover retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s.
2. add DHCP_DOES_ARP_CHECK to menuconfig for users to specify if do a ARP check on the offered address.
If enable, one more second will be taken in obtaining IP address.
3. update wifi libs
Without this, it's possible for stale information to be read from
cache via mmap, even if the MMU table entry had been invalidated
prior to writing flash (if the same MMU table entry was re-used after
writing flash.)
docs: use custom roles to generate GitHub links
This change replaces direct links to GitHub master branch with
auto-generated links using docutils custom roles.
These auto-generated links point to the tree or blob for the git commit
ID (or tag) of the repository. This is needed to ensure that links don’t
become broken when files in master branch are moved around or deleted.
The following roles are introduced:
```
- :idf:`path` - points to directory inside ESP-IDF
- :idf_blob:`path` - points to file inside ESP-IDF
- :idf_raw:`path` - points to raw view of the file inside ESP-IDF
- :component:`path` - points to directory inside ESP-IDF components dir
- :component_blob:`path` - points to file inside ESP-IDF components dir
- :component_raw:`path` - points to raw view of the file inside ESP-IDF
components dir
- :example:`path` - points to directory inside ESP-IDF examples dir
- :example_blob:`path` - points to file inside ESP-IDF examples dir
- :example_raw:`path` - points to raw view of the file inside ESP-IDF
examples dir
```
A check is added to the CI build script, which searches RST files for
presence of hard-coded links (identified by tree/master, blob/master,
or raw/master part of the URL).
This check can be run manually: cd docs && make gh-linkcheck
Additionally, Sphinx linkcheck build type is used to create new CI test,
which check for broken links. This test has to be triggered explicitly,
because including it in normal build process (when the commit is not yet
deployed to Github) will not work. It can be triggered in a regular
fashion using a combination of cron and Curl, similar to stress tests.
See merge request !455
This change replaces direct links to GitHub master branch with
auto-generated links using docutils custom roles.
These auto-generated links point to the tree or blob for the git commit
ID (or tag) of the repository. This is needed to ensure that links don’t
become broken when files in master branch are moved around or deleted.
The following roles are introduced:
- :idf:`path` - points to directory inside ESP-IDF
- :idf_blob:`path` - points to file inside ESP-IDF
- :idf_raw:`path` - points to raw view of the file inside ESP-IDF
- :component:`path` - points to directory inside ESP-IDF components dir
- :component_blob:`path` - points to file inside ESP-IDF components dir
- :component_raw:`path` - points to raw view of the file inside ESP-IDF
components dir
- :example:`path` - points to directory inside ESP-IDF examples dir
- :example_blob:`path` - points to file inside ESP-IDF examples dir
- :example_raw:`path` - points to raw view of the file inside ESP-IDF
examples dir
A check is added to the CI build script, which searches RST files for
presence of hard-coded links (identified by tree/master, blob/master,
or raw/master part of the URL).
This check can be run manually: cd docs && make gh-linkcheck
Additionally, Sphinx linkcheck build type is used to create new CI test,
which check for broken links. This test has to be triggered explicitly,
because including it in normal build process (when the commit is not yet
deployed to Github) will not work. It can be triggered in a regular
fashion using a combination of cron and Curl, similar to stress tests.
1. clean up bluetooth storage log prints;
2. reduce maximum link key storage size
3. modify so that the link key information of the latest connected device is stored at first
Update esptool.py to v2.0-beta1
* Minor bug fixes, no major functionality changes from the esp-idf perspective.
* Now tracks master branch of esptool repo (finally!)
* Supports Python 3, although our other esp-idf Python tools don't yet support Python 3.
See merge request !396
If the DNS request is dispatched and performed very quickly,
then it can complete before tcpip_callback() actually returns,
in which case we'll destroy the actual err_t error value passed
in the message. Use a local variable for the tcpip_callback
error code so that can't happen.
Resolves#269https://github.com/espressif/esp-idf/pull/269
Move PHY options out of WiFi config, improve descriptions
- move PHY-related settings into new menu, make it dependent on WIFI_ENABLED || BT_ENABLED
- improve descriptions of Ethernet Kconfig options
See merge request !443
ESP32_PHY_MAX_TX_POWER option is only meaningful for WiFi, so previous
change made it depend on WIFI_ENABLED. However if WiFi is not enabled,
but BT is, this option becomes undefined which breaks phy_init_data
generation.
This change turns ESP32_PHY_MAX_TX_POWER into a hidden parameter, which
depends on PHY_ENABLED. New user-visible parameter,
ESP32_PHY_MAX_WIFI_TX_POWER is introduced which depends on WIFI_ENABLED
and is used as default value for ESP32_PHY_MAX_TX_POWER if WIFI_ENABLED
is set. Otherwise ESP32_PHY_MAX_WIFI_TX_POWER is set to 20.
newlib: fix register used for DPORT/RTC bug workaround
While there was no register at DR_REG_FRC_TIMER_BASE + 0x60, due to
peripheral address space wraparound this write actually affected one of
FRC2 registers, which is used by WiFi stack to implement legacy
ets_timer APIs.
This change uses FRC_TIMER_LOAD_REG(0) instead, which can be set to
known value safely.
See merge request !449
fixes for issues observed when using spi_flash
This MR fixes three unrelated issues:
- Race condition in spi_flash_enable_interrupts_caches_and_other_cpu
when operations on unpinned tasks are performed.
The issue is reported in https://github.com/espressif/esp-idf/pull/258
- esp_intr_noniram_disable doesn’t disable interrupts when compiled in
release mode. This issue manifested itself with an illegal instruction
exception when task WDT ISR was called at the time when flash was
disabled.
Fixes https://github.com/espressif/esp-idf/issues/263.
- Tick hooks on CPU1 were not called if CPU0 scheduler was disabled for
significant amount of time (which could happen when doing flash erase).
The issue manifested itself as “INT WDT timeout on core 1” error.
Fixes https://github.com/espressif/esp-idf/issues/219.
See merge request !441
While there was no register at DR_REG_FRC_TIMER_BASE + 0x60, due to
peripheral address space wraparound this write actually affected one of
FRC2 registers, which is used by WiFi stack to implement legacy
ets_timer APIs.
This change uses FRC_TIMER_LOAD_REG(0) instead, which can be set to
known value safely.
The block which dispatches ticks on CPU1 was a copy of the code block
for the normal path (CPU0). It used to check uxPendedTicks, with the
logic that uxPendedTicks can be 0 iff the scheduler is not suspended.
On CPU1 however, uxPendedTicks is not related to the state of the
scheduler (as uxPendedTicks is updated on CPU0). Due to this, if CPU0
scheduler was suspended, and uxPendedTicks happened to be nonzero,
tick hooks on CPU1 didn’t run, even though CPU1 scheduler was working.
This change removes the check for uxPendedTicks in CPU1 code path,
so that the tick hooks on CPU1 always get called (as for the CPU0 code
path).
Allow writes to encrypted partitions
There is a size alignment requirement but it is checked by
spi_flash_write_encrypted. However, this check flat-out bans encrypted
writes.
Original PR on Github: https://github.com/espressif/esp-idf/pull/249
See merge request !432
When compiling in release mode, compiler was choosing same register for
oldint and intmask variables, so INTENABLE was never modified.
This effectively broke disabling of non-IRAM interrupts during flash
operations, observed in the existing tests if task watchdog is enabled.
This change adds an extra constraint tells the compiler that output
operand should not be placed into the same register as an input one.
Add python script that parses list of unit test cases for CI from component test folder
Modify .gitlab-ci.yml to run this script as part of build unit tests stage
spi_flash_enable_interrupts_caches_and_other_cpu function used to enable
non-IRAM interrupts after giving up flash operation lock, which would
cause problems if another task was waiting on the lock to start a flash
operation. In fact, non-IRAM interrupts should be re-enabled before the
task scheduler is resumed. Otherwise non-pinned task can be moved to the
other CPU due to preemption, causing esp_intr_noniram_enable to be
called on the other CPU, causing an abort to be triggered.
Fixes the issue reported in
https://github.com/espressif/esp-idf/pull/258
Delete option to select core timer 2 as a FreeRTOS tick source
Core timer 2 is unusable for FreeRTOS ticks because it triggers a high-level interrupt. This MR deletes the option to select it.
Ref https://github.com/espressif/esp-idf/issues/234
See merge request !418
In some cases (when RTC register reads are performed from the APP CPU), a write to FRC_TIMER_INT_REG may be lost on the bus.
Writing to another DPORT register immediately before or after that works around the issue.
We write one dummy value to an address which doesn’t have any register associated with it.
Fixes https://github.com/espressif/arduino-esp32/issues/120
1. add openssl option at menuconfig
2. remove SSL_ERR to reduce complexity
3. add more functions about debugging and assert
According these, our coders and customers may use and debug the OpenSSL code easily.
One common pattern of using assert function looks as follows:
int ret = do_foo();
assert(ret == 0); // which reads as: “do_foo should never fail here, by design”
The problem with such code is that if ‘assert’ is removed by the preprocessor in release build,
variable ret is no longer used, and the compiler issues a warning about this.
Changing assert definition in the way done here make the variable used, from language syntax perspective.
Semantically, the variable is still unused at run time (as sizeof can be evaluated at compile time), so the compiler
can optimize things away if possible.
These functions are marked as inline and are called from functions which are in IRAM.
In release (-Os) builds, the compiler may decide not to inline these functions.
Placing these functions into IRAM explicitly works around this.
update wifi lib: fix some wifi lib bugs
1. net80211: fix get ap info error(a4614877)
2. tw9358: sta mac same with softap(ea38d32c)
3. tw9221: scan channel error when connected(183d469c)
See merge request !425
bootloader_random_disable: Restore all SARADC/I2S registers to defaults
Fix for issue with I2S0 not being usable after bootloader_random_enable()
See merge request !415
fixes for github issues
This MR includes commits from several Github PRs, as well some fixes for issues reported on Github and on the forum.
- compile PHY-related code only when WiFi is enabled
- fix macOS setup instructions
- fix some of the Sphinx warnings
- update docs index, improve structure of the readme-
- wifi: fix typos, rename ESP_ERR_WIFI_NOT_START to ESP_ERR_WIFI_NOT_STARTED
- sdmmc: fix explanation of flash voltage regulator configuration efuses
- sdmmc: change idx num of example
- fix i2c_get_period name
- fix esp_log_level_set function name in docs
See merge request !420
If using WIFI_INIT_CONFIG_DEFAULT, error message will point out lack
of WiFi. Otherwise linker errors on WiFi symbols should help give a
clue as to what is broken.
Piggy-backs on changes in !420, ref github #230#237
Fix panic register dump format
Fix misplaced a printf somewhere causing an enter to be printed after every register in the panic regdump instead of every 4th register.
Fixes https://github.com/espressif/esp-idf/issues/236
See merge request !419
esp32 core dump to flash
1. menuconfig option to select where to store core dump: flash, uart or disable
2. Saving of core dump to flash
3. Partition table definitions files with core dump partition
4. Python scripts to support core dump generation from GDB command line
See merge request !341
The following issues mentioned during MR!341 review were fixed:
1) Core dump test application description
2) Usage of CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH and CONFIG_ESP32_ENABLE_COREDUMP_TO_UART
3) FLASH_GUARD_START macro usage is fixed in flash API
4) Core dump module logging facility
5) cache util functions doc updated
6) interactive delay before print core dump to uart
7) core dump partion support in build system
component bt:Added the create attribute table method to the new API
GATT Server service table APIs.
Have already modify the style and other things as @jeroen suggestion in other MR(the MR have been closed)
See merge request !399
Deep sleep stub may call ets_update_cpu_frequency, which has been moved from ROM to IRAM.
Restore the ROM version in the linker script, call it ets_update_cpu_frequency_rom, use it in the deep sleep stub.
fix mbedtls unit tests, fix IDF_VER when building a project outside ESP-IDF tree
- mbedTLS test needs about 5% more time to run (in debug mode) when building with 5.2.0, compared to 4.8.5. Increase the timeout to let the test pass.
- when doing `git describe` in IDF_VER definition, `-C $(IDF_PATH)` is needed to get the version of ESP-IDF, and not the project being built (which may not even be in git)
See merge request !411
1) PS is fixed up to allow GDB backtrace to work properly
2) MR!341 discussion: in core dump module: esp_panicPutXXX was replaced by ets_printf.
3) MR!341 discussion: core dump flash magic number was changed.
4) MR!341 discussion: SPI flash access API was redesigned to allow flexible critical section management.
5) test app for core dump feature was added
6) fixed base64 file reading issues on Windows platform
7) now raw bin core file is deleted upon core loader failure by epscoredump.py
Complimentary changes:
1) Partition table definitions files with core dump partition
2) Special sub-type for core dump partition
3) Special version of spi_flash_xxx
4) espcoredump.py is script to get core dump from flash and print useful info
5) FreeRTOS API was extended to get tasks snapshots
Clean up WiFi & Bluetooth config options
* Splits "WiFi" configuration out from ESP32 configuration submenu to its own menu.
* Renames "BT" to "Bluetooth", enabling Bluetooth is now in this option not the ESP32 submenu.
* Also disables compiling/linking of BT stack if Bluetooth is disabled, saves some build time.
See merge request !397
update toolchain version, rebuild newlib
- This MR updates the toolchain version used in the ESP-IDF
- Compiler version check and warning is added to project.mk
- Newlib is rebuilt to include wcsftime function
- libstdc++ build uses correct newlib headers (so we won't get undefined reference to `__impure_ptr` anymore)
See merge request !387
esp32: fixs about auto-reconnect and ap ssid configuration
1. Remove auto-reconnect
2. Use strnlen instead strlen to calculate ssid len in wifi lib
See merge request !407
component/bt: check for registration status of callback function before using it
Add checking of NULL function pointers when calling bluetooth callbacks, especially before the callback functions are registered
See merge request !406
add wpa2 set id api and modify null data tx description
1. wpa2: add wpa2 set id api
2. low rate: modify null data tx description
See merge request !402
ethernet: support flow control
(1) Only fullduplex mode support flow ctrl .
(2) Fix reboot exception which caused by not-reset EMAC hardware (such as DMA) when reset CPU.
See merge request !392
component/bt: bug fix of lack of checking bluetooth stack status inside API functions
Add an API function for checking bluetooth stack status: whether it is uninitialized, initialized or enabled.
The function is intended to be used by users to check the bluetooth stack status, also, it is used inside bluetooth API functions to ensure the stack is in valid state.
See merge request !405
Place cross-core interrupt into IRAM, sanity check handler address passed into esp_intr_alloc
Cross-core interrupt handler was not marked with IRAM_ATTR.
The reason why this caused an exception is probably due to some tasks running at highest priority (these are not blocked by spi_flash_disable_caches_interrupts_and_other_cpu mechanism).
This change puts the interrupt handler into IRAM and adds a sanity check into `esp_intr_alloc`.
Reported on Github: https://github.com/espressif/esp-idf/issues/211
See merge request !404
build system: add IDF_VER environment variable and preprocessor define
This adds an `IDF_VER` preprocessor define which is obtained from `git describe`.
Looks like `v1.0-275-g0efaa4f` for non-release version or `v2.0` for a tagged (release) version.
See merge request !403
Add option to automatically set a watchpoint at the end of the swapped-in task
This should make stack overflows easier to debug because it triggers a debug exception as soon as the stack is overwritten, not later when a context switch happens. Marked as a FreeRTOS debug feature because it doesn't give a nice error message and uses up a watchpoint.
See merge request !389
Fix tcpip_adapter_set_hostname issue
The default hostname for each interface is "espressif", users can call this API to change each interface's hostname.
See merge request !284
examples/10_openssl_server: fixup SSL server with method of specific version
1. add method of any version supporting at OpenSSL and add API in header file
2. change OpenSSL server context method to be method of any version
Fixes http://esp32.com/viewtopic.php?f=14&t=696.
See merge request !369
Fix OpenOCD detection code
In the current master, detection of an attached OCD is broken. This fixes it.
I also snuck in two unrelated checks in intr_alloc which return from a function that is asserted earlier in the code. This makes the code behave better when they are called erroneously in a production build.
See merge request !377
bootloader: export ets_update_cpu_frequency
MR !363 added linking librtc into bootloader. At the same time, MR !373 removed ets_update_cpu_frequency from ROM exports ld script, and replaced it with a dual CPU aware version. Combining these two MRs caused linker error in bootloader due to the unresolved `ets_update_cpu_frequency`.
One option to fix this is to move the definition of ets_update_cpu_frequency into bootloader_support component. This does however look a bit odd because this function is not something that is specifically needed for bootloader support.
Another option is to export the ROM version of ets_update_cpu_frequency for the bootloader only. This means that when bootloader changes CPU frequency, it only updates the tick period variable for PRO CPU. This isn't an issue though, because app startup code still calls the dual CPU aware version of ets_update_cpu_frequency early on, before any non-trivial code can run on the APP cpu.
This MR uses the second approach. Looking forward, we may move this definition of ets_update_cpu_frequency into the rtc_clk component, which will be used both by the bootloader and the app, and placing ets_update_cpu_frequency there would be logical.
See merge request !384
SDMMC peripheral driver, SD protocol driver, FATFS library, VFS integration
This MR contains:
- SDMMC host peripheral driver
- SD protocol driver in sdmmc component (can be extended to support MMC/eMMC and SPI based hosts)
- ChaN's FATFS library v0.12b
- VFS integration
- FAT access via VFS is thread-safe (unless same file is read/written/unlinked/renamed from different tasks)
- Support for POSIX directory-related functions in VFS (and in vfs_fatfs.c)
- unit test for the above
- Example
- API documentation
Will be done in other MRs:
- Support for spi_flash IO driver for FatFs
- SPI host driver and support for SPI mode commands in sdmmc component
- MMC/eMMC support in sdmmc component
- Support for slightly higher 53/26.6MHz clocks (currently I'm using 20MHz for DS and 40MHz for HS, instead of 25MHz/50MHz per standard), and arbitrary low clocks (e.g. 4MHz).
See merge request !353
C++ support
This change adds necessary support for compiling C++ programs:
- linking against libstdc++
- implementation of static initialization guards using FreeRTOS primitives: since we don't have condition variables at our disposal, and we don't want to allocate a synchronization primitive for every guard variable generated by the compiler, we imitate condition variables using a combination of a mutex, counting semaphore, and a counter (based on [Microsoft Research paper](https://www.microsoft.com/en-us/research/wp-content/uploads/2004/12/ImplementingCVs.pdf), albeit because we don't need *arbitrary* code to use these CVs, implementation gets simpler).
Note that libstdc++ also contains an implementation of `__cxa_guard_{acquire,release,abort}` functions. These implementations come from an `#ifndef GXX_THREADS` branch, i.e. are not aware of multthreading. There are three ways of replacing these libstdc++ functions with our implementation:
1. Move our code into gcc. Pros: cleanest solution. Cons: Such changes are unlikely to be merged by any upstream, so we end up maintaining our own forks of {gcc,crosstool-ng}.
2. Use library as it is built by crosstool, use `ar` to delete one object file (`guards.o`), add this library to ESP-IDF. Pros: easy to implement. Cons: libstdc++ is a 15MB binary 😯
3. Keep using libstdc++ from crosstool, force our implementation to be linked using a `-u` linker flag. Pros: no impact on repo size, easy to implement. Cons: somewhat less clean than 1 (and about as hacky as 2).
For the reasons mentioned, option (3) looks like the best tradeoff.
Ref. TW6702
See merge request !364
Enable bootloader entropy source for RNG
Enables an entropy source when bootloader starts up, which both seeds the RNG for use before WiFi/BT stack is enabled and provides an adequate RNG for secure boot & flash encryption key generation.
A prerequisite was enabling 80MHz operation, so the CPU is now set to 80MHz as soon as second stage bootloader starts running.
See merge request !363
add menuconfig option to enable SO_RCVBUF
This option is required by Arduino and enables netconn connection to be queried for amount of data available in the rx buffer.
See merge request !372
esp32: ets_update_cpu_frequency should set tick scale for both CPUs
ets_update_cpu_frequency ROM function updates g_ticks_per_us, which is has two copies, one for each CPU.
The APP CPU copy of g_ticks_per_us never got updated, resulting in shorter delays produced by ets_delay_us on the APP CPU.
This MR replaces ROM ets_update_cpu_frequency with a copy in IRAM which updates scaling factors on both of the CPUs.
So now we get expected delays (in microseconds):
```
ets_delay_us core=0 expected=50000 actual=50014
ets_delay_us core=1 expected=50000 actual=50015
vTaskDelay core=0 expected=50000 actual=49428
vTaskDelay core=1 expected=50000 actual=50000
```
Reported on the forum: http://esp32.com/viewtopic.php?f=2&t=713#p3722
See merge request !373
SPI master driver
This merge requests adds an SPI Master driver. This driver is (of course) multithread capable, has device abstraction, has command queueing, DMA support and all other sorts of nice things you'd expect from a SPI driver.
See merge request !332
modify bootloader dram start address, swap app bss and data segments
Modify bootloader dram_seg from address 0x3ffc0000 to 0x3fff0000, len from 0x20000 to 0x10000.
Also put app .data before .bss, to reduce the chance .data collides with ROM bootloader stack.
See merge request !375
This change reduces chances that a large .bss segment will push .data all the way into
0x3ffe1320 — 0x3ffe5320 range where the bootloader stack is, creating a problem when
bootloader will be loading application into memory.
With this change, .data would need to be at least 200k big to cause problems.
Modify bootloader dram_seg from address 0x3ffc0000 to 0x3fff0000, len from
0x20000 to 0x10000. Please be notified that this is just a workaround for
fixing app data overwrite bootloader data issue!
1. add fading functions.
2. clear up ledc.c and ledc.h
3. update api doc.
4. add ledc example
5. edit ledc.rst and add readme for example code.
6. add s_ prefix for static global values.
7. add mutex for fade functions
8. minor changes according to the comments.
1. add method of any version supporting at OpenSSL and add API in header file
2. change OpenSSL server context method to be method of any version
Fixes http://esp32.com/viewtopic.php?f=14&t=696.
1. Update wifi lib which contains ampdu and other optimizations
2. Add throughput code debug code
3. Other misc modification about throughput optimization
2. update example comments and other minor changes
3. rename API: i2c_cmd_link_create/i2c_cmd_link_delete (+4 squashed commits)
Squashed commits:
[2e0ac3e] 1. coding style: add one space after condition key words.
2. modify i2c.h, use gpio_num_t instead of int, improve comments of return values
3. add i2c index in index.rst
4. add readme for i2c example
[4991d92] update i2c.doc
[88b672e] driver: i2c
1. add mux and spin lock to run in a thread-safe way.
2. modify example code
[4eb15fe] driver: i2c code
1. add i2c master code
2. add i2c slave code
3. add i2c example code
4. add DRAM_ATTR for I2C array
bugfix: uart event mismatch
Fix bug of uart frame error and parity error interrupt mismatch in driver code, which will cause the corresponding interrupt can not be cleared correctly, and will finally cause a interrupt watch dog.
See merge request !335
GPIO driver: add per-pin interrupt handlers
1. add ISR handler apis so that users of different layers can hook their own isr handler on different GPIO.
Audio project has different software layers, they need different gpio isr handler for layer instead of processing all GPIO interrupts in one handler.
If this kind of calling a handler from isr is not proper, please kindly point out.
2. add gpio example code.
3. update gpio doc.
See merge request !345
1. add ISR handler apis so that users of different layers can hook their own isr handler on different GPIO.
Audio project has different software layers, they need different gpio isr handler for layer instead of processing all GPIO interrupts in one handler.
If this kind of calling a handler from isr is not proper, please kindly point out.
2. add gpio example code.
3. improve gpio.rst
4. add readme for gpio example
Squashed commits:
[278e50f] update: GPIO
1. coding style, add a space between conditional or loop keyword and an opening paren.
2. modify some return value and doc
3. use printf in example code
Squashed commits:
[efb23bb] minor change of comment
freertos: fix dual core issue
This commit try to fix dual issue tw9313 raised by QA
1. Put per-core data into critical session or interrupt disabled/enabled session
2. Idle task may have problem when it terminate the task in both core
See merge request !333
1. The transmitting mode of the packets from LWIP to MAC is changed from synchronous to asynchronous.
2. The receive buf mode : support pointer mode and copy mode.
3. Add get phy status func used to config mac register.
1. Fix bug of uart frame error and parity error interrupt mismatch in driver code, which will cause the corresponding interrupt can not be cleared correctly, and will finally cause a interrupt watch dog.
2. Add gpio pull-up for rx pin and cts pin.
This commit fixes:
1. xTaskGetCurrentTaskHandle may return wrong TCB when current task switch to a different core
2. Idle task may have problem when it terminate the task in both core
Minor fixes from various sources
- Fix memory debugging code. Noticed by Tuan.
- intr_enable/disable should be in IRAM. Noticed by rojer
- Still old timer code in examples in doxygen comments. Noticed on the forum by jumjum123
- Timer example was broken. Noticed on the forum by jumjum123
See merge request !325
ULP: add new instructions, fix bugs, add tests
This adds peripheral register read and write instructions, an instruction to wake the SoC from deep sleep, and some tests.
Also fixes two bugs: ANDI instruction definition, and running the ULP when in deep sleep mode.
See merge request !317
Fix exception handler to jump to correct vector instead of crashing to the double exception vector.
One-character fix... basically, this caused the exception handler to crash into the double-exception handler instead of nicy panic'ing.
See merge request !323
Secure boot: Option for app & partition table signing to happen outside build system
Allows for a remote signing server, private signing key does not need to be on the build system.
See merge request !320
Allow gw to be null
Github Pull Request 163: https://github.com/espressif/esp-idf/pull/163
Allow interfaces to be configured without a default gateway, for
local-only communication.
In case of the AP interface, if gw is not set, do not offer it.
See merge request !312
1. change all gatt cb function to 3 args and function type. add gattc_if/gatts_if as second argument
2. delete gatt_if of "gatt cb param"
3. separate conn_id and gatt_if from conn_id
4. change the demo code as the gatt changed
1. add sigma-delta code and example.
2. add gpio output signal in io matrix.
Squashed commits:
[a25e7d4] minor changes for doc
[6a03a1e] minor changes on comments and doc.
[97dd9e4] Add doc.
update index.rst
change example index
Starting the ULP using SENS_SAR_START_FORCE_REG doesn’t disable clock gating of RTC fast clock.
When SoC goes into deep sleep mode, RTC fast clock gets gated, so ULP can no longer run.
Instead, it has to be started using the timer (RTC_CNTL_ULP_CP_SLP_TIMER_EN bit).
When ULP is enabled by the timer, clock also gets enabled.
This change allows setting pin configuration for EXT1 wakeup depending on the state of RTC_PERIPH power domain:
- if peripherals are enabled (due to another wakeup mode, or due to esp_deep_sleep_pd_config call), we can keep internal pullups/pulldowns enabled
- if peripherals are disabled, pullups and pulldowns need to be disabled as well
Also add comments about the purpose of registers being configured.
This adds a workaround for a bug that following deep sleep wakeup, ISO (bus isolation) signal may be set for RTC fast memory.
We set FORCE_NOISO bit in RTC_CNTL_PWC_REG until we find out what is causing ISO signal to be set.
When ESP32 wakes up from deep sleep, flash is accessed an approximately 900us after power on.
Some flash chips need more time to become ready. This change adds a menuconfig option to add
some delay to the default deep sleep wake stub.
Fixes https://github.com/espressif/esp-idf/issues/117
This adds the following APIs to enable various wakeup sources:
- esp_deep_sleep_enable_timer_wakeup
- esp_deep_sleep_enable_ulp_wakeup
- esp_deep_sleep_enable_ext0_wakeup
- esp_deep_sleep_enable_ext1_wakeup
And an API to start deep sleep:
- esp_deep_sleep_start
1. TW8657, WIFI send the whole packet to smartconfig;
2. modify API annotation of smartconfig and sniffer;
3. export smartconfig APIs to programming guide;
lwip: fix lwip dual core issue
Call xSemaphoreGiveFromISR instead xSemaphoreGive when the calling context is in critical section.
See merge request !314
Restore ability to alloc IRAM, and more.
- Fix mem regions so allocating IRAM works again
- Optimize allocator slightly, uses 4 less bytes per malloc now
- Allow querying free heap memory space per memory type
See merge request !301
Bugfix/btdm bluedroid
Cleanup all the warnings。
Fix GATT CLIENT cannot receive notfiy/indicate from GATT SERVER bug.
Originally, bluetooth have its own master branch(feature/btdm_bluedroid), all the bluetooth sub branch will merge to feature/btdm_bluedroid firstly. If feature/btdm_bluedroid is ready, it will request merge to master. But as Ivan/JG/Jack's requires, all the bluetooth bugfix or feature will request merge to master ASAP.
This MR contains "cleanup warning " and "some bug fix", after, every merge request only contain one thing.
See merge request !286
1. enable will malloc, but disable don't free resolving list, so fix it
2. In disable procedure, it will alloc alarm to hash_map, and all the alarm hash_map will be free in deinit. So this need not be fixed currently.
build system: Linker scripts or binary libraries should trigger a re-link
Add binary libraries and linker scripts to the list of dependencies for the ELF file.
Fixes TW7816.
See merge request !307
Allow interfaces to be configured without a default gateway, for
local-only communication.
In case of the AP interface, if gw is not set, do not offer it.
1. fix the exception of deinit/disable
2. debug mem leak of deinit, fix some memleak, but still something wrong.
3. debug men leak of disable.
4. add bluedroid memory debug
“Full” printf uses more stack space than “nano” printf, and more space than available in the idle task.
This caused stack overflow in TLS delete test. Replacing printf with ets_printf.
add supported stress test to CI
add supported stress test to CI:
stress test requires long time to execute. They will only be executed when variable NIGHT_BUILD=YES. Therefore we'll use gitlab-API trigger to execute stress test cases.
See merge request !220
drivers: remove file paths from log statements
Function name and error string are usually sufficient to find the place which has triggered an error.
`__FILE__` macro generates a string which has absolute file name (with our build system), which add many long strings to the program binary.
Also change log tags to lower case to match style used elsewhere.
Fixes https://github.com/espressif/esp-idf/issues/126
See merge request !282
Flash encryption support
Flash encryption support in build system, tooling
To come in future MR:
* On-device key generation on first boot (for production devices), need to finalise testing of bootloader entropy seeding.
* spi_flash_encrypted_write to support non-32-byte block writes (at least optionally.)
* I think a lot of the bootloader_support component can possibly be rolled into "spiflash" and other components, to use a common API.
See merge request !240
Add dynamic interrupt allocation mechanism
This adds:
- Dynamic allocation of interrupts. Pass it the features of the interrupt you want, it'll set you up with an int.
- Shared interrupts. Enables multiple peripheral drivers to use the same interrupt.
- Marking what interrupts are fully executable from IRAM; if an int isn't marked like that it will get disabled once flash cache gets disabled.
Also:
- Modifies driver to be in line with these changes
See merge request !254
Fail CI build on warnings
This allows developers to add CFLAGS for -Wno-error=XXX while developing, but before code passes the CI build then it must be warning-free.
See merge request !279
newlib: add "full" formatting support
This change adds support for 64-bit formats and C99 features to newlib printf/scanf functions. This support is enabled by default in menuconfig, but can be switched off to reduce code size.
Also adds missing functions such as fmod and fmodf.
- Fixes https://github.com/espressif/esp-idf/issues/52
- Fixes https://github.com/espressif/esp-idf/issues/83
See merge request !274
- add two versions of libc: libc.a and libc_nano.a. First one has full C99 formatting support, second one uses “nano” formatting functions available in ROM.
- fix linker error for fmod, fmodf, atof, atoff
- update tests
UART console selection
This change adds a set of menuconfig options to set custom UART#, baud rate, and pins, for console output.
Ref. TW8146
Also includes the following changes:
- `uart_tx_wait_idle`: fix issue with last character not transmitted. ROM function `uart_tx_wait_idle` may have a bug which causes the function to return before the final character is fully transmitted. This replaces `uart_tx_wait_idle` declaration with a static inline definition which fixes the issue. Also replaces the use of `uart_tx_flush` with `uart_tx_wait_idle` in `esp_restart`, to remove garbage in console output on restart.
- `rtc_printf` is temporary replaced with a no-op, pending a new release of librtc.a. Current release assumes that UART0 is used for output,
and switches UART0 baud rate while doing frequency changes and printing some log output. This doesn’t work if a different UART is used for output.
- disable boot watchdog only after starting the main task. Boot watchdogs were disabled very early in startup code. It was possible to introduce an infinite loop anywhere in the many functions called from startup code, and this would not be detected by interrupt watchdog and task watchdog. This change postpones disabling of boot watchdogs to the point when the scheduler is running. Also replaces register expressed using integer address with a name. This change is not directly related to the previous ones, but was found while debugging UART selection features.
See merge request !288
Removal of spurious newline character in debug statement
There was a debug statement in the code that included an additional newline character that wasn't needed.
From github PR: https://github.com/espressif/esp-idf/pull/124
See merge request !291
On Xtensa windowed ABI backtrace is easy to do, and it's immensely
useful for debugging, so - do it by default.
We try to be careful and not deref bogus pointers while walking the
frames.
Example output (from debugging espressif/esp-idf#133):
Backtrace: 0x1:0x3ffc51e0 0x400e9dfa:0x3ffc5210 0x400e9ebc:0x3ffc5230 0x400ec487:0x3ffc5260
With just addr2line utility from binutils, this already pinpoints the
location of the crash.
Boot watchdogs were disabled very early in startup code. It was possible to introduce an infinite loop anywhere in the many functions called from startup code, and this would not be detected by interrupt watchdog and task watchdog. This change postpones disabling of boot watchdogs to the point when the scheduler is running. Also replaces register expressed using integer address with a name.
- ROM function uart_tx_wait_idle may have a bug which causes the function to return before the final character is fully transmitted.
This replaces uart_tx_wait_idle declaration with a static inline definition which fixes the issue.
- Also replaces the use of uart_tx_flush with uart_tx_wait_idle in esp_restart, to remove garbage in console output on restart.
- rtc_printf is temporary replaced with a no-op, pending a new release of librtc.a. Current release assumes that UART0 is used for output,
and switches UART0 baud rate while doing frequency changes and printing some log output. This doesn’t work if a different UART is used for output.
This change adds a set of menuconfig options to set custom UART#, baud rate, and pins, for console output.
Setting happens in bootloader startup code for PRO CPU, and in application startup code for APP CPU.
Ref. TW8146
feature(rtc_module):add rtc module
1. add rtc io control API (pull,output and input)
2. add touch pad API (touch pad read and interrupt)
3. add adc1 API (the max width is 12 Bits and support attenuation)
4. add hall sensor API (support hall sensor read )
5. add dac API (the width is 8 Bits)
bugfix(gpio):gpio32 and gpio33 can not output and input
the gpio32 and gpio33 is initialize by librtc.a,and gpio_config not initialize the gpio as
digital gpio.they can not output and input,when users use gpio32 or gpio33.And there are some problems
about others driver ,when they use gpio32 or gpio33 as matrix.
Function name and error string are usually sufficient to find the place which has triggered an error. __FILE__ macro generates a string which has absolute file name (with our build system), so there is a lot of long strings present in the program because of that.
Fixes https://github.com/espressif/esp-idf/issues/126
Small debugging fixes
Invoke panic handler when a stack overflow has been detected; unhandled interrupt handler now prints interrupt/cpu number for easier pinning down of source.
See merge request !277
Gdbstub: Fix bug, small cleanup
Tianzhongxing found a small bug preventing gdbstub to work in certain cases. This fixes it, as well as including some minor cleanups.
See merge request !260
Initial support for generation of ULP coprocessor code
This adds basic support for writing ULP coprocessor programs using an assembly-like syntax, with integer labels and branches to labels.
See merge request !261
* App access functions are all flash encryption-aware
* Documentation for flash encryption
* Partition read/write is flash aware
* New encrypted write function
Feature/btdm bluedroid
This branch contain the bluedroid host code.
Currently, Only GAP/GATT SERVER/GATT CLIENT release to users.
Actually, the content of the codes is further more than GAP/GATT and etc.
In this release version, users only need to concern about the APIs which are in "api/include/".
Now, suggestions in comment have been resolved are following:
1. The APIs use callback function. Ivan , Jeroen and me have discussed it. Currently the code will not be changed.
2. The APIs use OPEN/CLOSE. I have ask Ivan, besides bluedroid do this, we will keep the name.
3. Coding style. I have run format.sh to handle the style. And some spell error have been fixed.
4. APIs doxygen. I have clean the warning by doxygen. But bt.rst is still need to be completed.
5. Other comment without resolved face to face that I have to add response in the comment and fix them in the code
6. Fix some incorrect things. See the git log for details.
This 1st version of bluedroid release still have lots of things to do. But it can be done after this merge.
1. Compelete the BLUFI(Bluetooth config wifi connection) documents, security, application protocol and other.
2. Add SPP-LIKE profile.
3. Do more examples codes to cover most of the APIs.
4. Test and fix bug.
Another thing:
1. Do the document of APIs.(xml->bt.rst->html)
(I will do this before merge as Ivan's suggestion)
This is already done. Besides, the union type in doxygen have something error. Ivan will fix it.
See merge request !239
bugfix/init_factory_bin: fix inconsistency between bootloader and OTA code
init_factory_bin: 2nd bootloader use a wrong logic select factory image to boot,and some bug in OTA code
See merge request !266
1. fix tw8911 sleep in scan leads to auth frame malloc fail.
2. fix tw8913 pm state transfer wrong leads to wdt.
3. make some comments for modem sleep and wpa2 enterprise.
4. removd duplicated debug option ESP_THREAD_SAFE_DEBUG
esp32: update wifi lib to fix tw8868
In AP bridge mode, the length of the forwarded data is wrong, it's 26Btyes longer, thus cuase
AP can't forward the data of which length is 1460. This modification is to make the
data length right.
See merge request !262
In AP bridge mode, the length of the forwarded data is wrong, it's 26Btyes longer, thus cuase
AP can't forward the data of which length is more than 1460. This modification is to make the
data length right.
esp32: fix tw8851 some phy version cause wifi connect fail
Update phy version to 258 to fix tw8851
When upgrade the phy version, the RF calibration version is not change, but the calibration data format is changed and the wrong calibration data causes wifi connection failure. The solution is to make RF calibration data and phy version the same version.
See merge request !258
1. update phy to version 258 to fix wifi upgrade cause wifi connect fail issue
2. update fix_printf.sh
3. fb5a2b07 - default set ps type to WIFI_PS_NONE
Add fota ops api
add ota core function implement
1. esp_ota_begin: init ota partition need to be update, output ota handle,every partition need ota should be init firstly
2. esp_ota_write: write image data to update partition, will record wrote size automatically
3. esp_ota_end: verify image after ota ended
4. esp_ota_set_boot_partition: set next boot partition
5. esp_ota_get_boot_partition: get current running partition
See merge request !256
Bugfix mbedtls sha384 clone()
mbedtls_sha512_clone() on a SHA-384 hash caused incorrect digest
Also adds additional mbedtls unit tests into the unit tests project (including one for this bug).
See merge request !252
lwip: fix socket memory leak issue
1. Add socket memory leak debug counter
2. Fix TCP PCB leak issue
Currently ESP32 support maximum 16 TCP PCBs and all TCP PCB are allocated from heap memory. In some scenario, we may
have memory leak issue, for example, the application already created 16 TCP PCB, then it close 5 of them, because the TCP
state machine, the LWIP core may not free all the 5 TCP PCB immediately, maybe some is in TIME_WAIT status, some is in
FIN_WAIT_1 etc. Then the application try to malloc 17th TCP PCB (the application think they just create 12 because they already
close 5), memp_malloc() will return true because the heap is not out of memory, but actually we got 17 TCP PCB. When the
scenario repeat again and again (in our Audio application, it repeat more than 10000 times), more and more TCP PCB will be
created in the system, each TCP PCB require 200B, then memory leak happen (In Audio application, I saw more than 26 TCP PCB
are created, and 10*200=2K memory are leaked).
See merge request !223
SHA acceleration integrated to mbedTLS incl. TLS sessions
Uses hardware SHA acceleration where available, fails over to software where not available.
Ref TW7112
See merge request !232
spi_flash_erase_range: Allow for 32KB blocks not 64KB blocks
SPI flash hardware sends 52h command, which is a 32KB erase.
There is a matching bug in the ROM SPIEraseArea code, unless
flashchip->block_size is modified first.
See merge request !249
ledc: fix reported error when div_param == 256
Whenever bit_num and freq_hz are such that div_param == 256, the code would flag that as an error.
In fact, value 256 of div_param was a valid one (HW requires that div_param >= 1.0, when interpreted as a Q10.8 fixed point value).
Changed the if statements a bit to make the logic clearer, and added more descriptive error messages.
Also added missing error for the unimplemented case of low speed mode.
Reported in https://github.com/igrr/esp32-cam-demo/issues/2
See merge request !247
driver: PCNT
1. add PCNT module in periph_ctrl.c/.h
2. add description of PCNT status in pcnt_struct.h
3. add PCNT driver code
4. add PCNT example code.
See merge request !229
uart: use same argument names in get/set functions
This one is pretty trivial: rename arguments so that same name is used for get and set functions.
https://github.com/espressif/esp-idf/issues/105
See merge request !248
system_* APIs cleanup
This changeset is mostly about cleaning up `system_*` APIs and moving them from libcore. It has dragged a few more changes along, however.
- `system_deep_sleep` deprecated, new name is `esp_deep_sleep`
- `system_efuse_read_mac` deprecated, new name is `esp_efuse_read_mac`
- `system_read/write_rtc_mem` removed (reason: we use linker to place code/data into RTC memory now)
- `system_get_sdk_version` deprecated. Returns "master" for now. Support for compile-time and runtime version detection will be done in a separate MR.
- `system_get_time` and variations have been deprecated. `gettimeofday` should be used instead.
- `system_restart` deprecated, new name is `esp_restart`. Rewritten code to work correctly from any of the cores.
- `system_restore` deprecated, `esp_wifi_restore` should be used instead.
- `system_get_rst_info` removed (it wasn't in a header file)
- RTC library has been updated to latest version
- Logging output from `libfoo.a` goes through `foo_printf` function now, where `foo ` is any of the library names. For libraries other than rtc and phy, this is a temporary measure, until we finish switching to esp_log library and clean up all uses of printf/ets_printf.
- ESP-IDF build will fail if any of the libraries have printf/ets_printf reference.
- Added `esp_random` function which gets values from HW RNG. I have added code which makes sure the value is not polled too often (allows at least 16 APB cycles). Also added a header file for HW RNG (just one register).
- Moved random number generation functions used by wpa library into wpa_supplicant component.
See merge request !234
SPI flash hardware sends 52h command, which is a 32KB erase.
There is a matching bug in the ROM SPIEraseArea code, unless
flashchip->block_size is modified first.
Whenever bit_num and freq_hz are such that div_param == 256, the code would flag that as an error.
In fact, value 256 of div_param was a valid one (HW requires that div_param >= 1.0, when interpreted as a Q10.8 fixed point value).
Changed the if statements a bit to make the logic clearer, and added more descriptive error messages.
Also added missing error for the unimplemented case of low speed mode.
UART driver: Fix crash in ISR due to "UART" static array moved to flash
Ref: http://esp32.com/viewtopic.php?f=13&t=546&sid=76ff371ae2b259441a2cf355e96d74b9#p2275
This is a really subtle bug, gcc noticed the UART array elements are read-only so
implicitly moved the elements to .rodata as if it was const. However
this array is accessed from the UART ISR, so has to be in IRAM or DRAM.
See merge request !245
Refs:
http://esp32.com/viewtopic.php?f=13&t=550http://esp32.com/viewtopic.php?f=13&t=551
rmt.c should include stdlib.h for malloc, esp_bignum,c &
https_request_main.c for abort().
FreeRTOSConfig.h is only including stdlib if
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is set. However, it is
included for abort() so needs to be included whenever
CONFIG_FREERTOS_ASSERT_FAIL_ABORT is set.
This change includes unconditionally in FreeRTOSConfig.h. This is to
avoid this kind of bug where compiler errors are dependent on config. I
suggest we don't change this to be more selective until we have 'make
randomconfig' style tests in CI.
Integrate unit tests into build system
This MR moves unit tests from esp-idf-tests repository into 'test' subdirectories of respective components.
Tests are run using a runner app in tools/unit-test-app.
This needs a bit of cleanup:
1. remove extra newlines added to makefiles,
2. re-format unit tests code which has tabs
3. write a document on using this test app
4. maybe some refactoring in project.mk
I think 1&2&4 need to be done in this MR, while 3 may be done in a follow-up one.
See merge request !221
Includes a tweak to make Static_task_t equal size to TCB_t when using
MPU_WRAPPERS . Matches tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE macro
in tasks.c. This isn't actually a bug (if static task allocation is off,
there is no use for Static_task_t), but it allows us to make consistent
compile-time checks that Static_task_t == TCB_t.
Without this change, building FreeRTOS with static allocation enabled succeeds, but trying to create a queue from a static buffer causes an assert because the size of static and dynamic queues differ.
1. change gap btc args to union to decrease the dram occupied by btc args
2. actually use individual args for every action is the best way(decrease the dram occupy), but for writing code easily and the style, use union
3. gatt server/client should do the same work
esp32: fix random pkt cause esp32 watchdog
This change fixes the ESP32 watchdog issue. When the MPDU of AMPDU is longer than 1600B,
esp32 will check whether the last 4B is DEADBEEF, if it's not DEADBEEF, it will assert
and the assert will cause esp32 watchdog. The solution is to init the last 4B to DEADBEEF
when malloc new ebuf for the packet longer than 1600B.
See merge request !233
SHA hardware allows each of SHA1, SHA256, SHA384&SHA512 to calculate digests
concurrently.
Currently incompatible with AES acceleration due to a hardware reset problem.
Ref TW7111.
rename nvs host test folder, modify .gitlab-ci.yml
remove unit-test-app build
re-format unit test files
remove extra newlines in project.mk
some refactoring for unit test part in project.mk
add build files of unit-test-app in gitignore
add README.md for unit test app
correct headings in README.md
remove files and make minor tweaks in unit test app
update .gitlab-ci.yml to use unit test app
delete unused lines in component_wrapper.mk
delete periph_i2s.h and lcd test
add text floating point in components/esp32/test/Kconfig
correct idf test build paths in .gitlab-ci.yml
This change fixes the ESP32 watchdog issue. When the MPDU of AMPDU is longer than 1600B,
esp32 will check whether the last 4B is DEADBEEF, if it's not DEADBEEF, it will assert
and the assert will cause esp32 watchdog. The solution is to init the last 4B to DEADBEEF
when malloc new ebuf for the packet longer than 1600B.
LWIP will drop the oldest package at the arp packet cache queue and return "ERR_OK"
We change it that ARP level will drop the current packet and return "ERR_MEM" to tell user that you should send the packet again latter.
hwcryto bignum support for RSA operations
Supporting RSA with hardware bignum directives.
Configurable via menuconfig to enable/disable, and to choose between busywaiting and interrupt driven completion.
May still be some performance tweaks possible.
TW7111
See merge request !92
Removes memory barriers for better performance, thanks Ivan for pointing
this out.
Manually unrolling the loop further seemed like diminishing returns.
When the parameter pbuf for low_level_output is a list, malloc a new pbuf of
which the length equals to the total length of pbuf and send the new pbuf to L2
Docs: new documentation and warnings cleanup
This change set
- adds a high-level description of application startup flow. Some parts are missing, but hopefully we can use this description as a base to expand on.
- adds a few notes about memory regions and their use in ESP-IDF.
- add SPI flash and partition APIs page
- fixes all Doxygen warnings in header files
- enables build failures on new Doxygen warnings
See merge request !201
Secure boot related fixes
Fix some issues (mostly build system) from the secure boot implementation
Also refactor the way submodule checks are applied to make them more reliable.
See merge request !207
nvs_flash: adjust the nvs_flash start sector number
Modify the nvs flash start sector from 6 to 9 because the partition table bin burn address is modified from 0x4000 to 0x8000
See merge request !215
lwip: add option to memcopy packet from L2 to L3
Menuconfig add an option to copy the packet from layer2 (WIFI driver) to layer3 (LWIP), default not copy
See merge request !211
Required at project level because some components use header files in
other components' submodules, and one component with a
submodule (esptool.py) doesn't have or need a component.mk.
Default esp-idf builds now show -Wextra warnings (except for a few:
signed/unsigned comparison, unused parameters, old-style C declarations.)
CI building of examples runs with that level raised to -Werror, to catch
those changes going into the main repo.
1. Actually, btc & api are the same module thing. So the type defined in api header file can be included by btc c/h files.
Besides, why btc & api should be separated, because that user may be aware of api and api refer defines/types, rather than other non-refer things.
All defines/types that user won't use should be put in btc directory (and define with prefix "btc_"), and which will be used by user should be defined with prefix "esp_" .
2. rename attribute value(all is value, not data)
1. which named uuid is esp_bt_uuid_t type
2. which named id is xxx_id_t type, such as service_id_t char_id_t, include inst & uuid
3. share include directory
Per-CPU interrupt handlers and args
Up to now, the interrupt handlers and args were shared between CPUs, that is, if you set an interrupt handler on CPU0, CPU1 would invoke the same interrupt handler on that interrupt. This code gives every CPU its own space for interrupt handlers.
See merge request !192
nvs: fix Page::findItem and Storage::findItem regression
When read caching was added, Page::findItem started modifying itemIndex reference argument even if item wasn't found.
Incidentally, Storage::findItem reused itemIndex when starting search at next page.
So,
- if the first page had a cached index (findItem was called for that page), and it pointed to a non-zero index,
- first page has a few empty items at the end (but is marked full),
- next search looked up the item on the second page,
- index of the item on the second page was less than the cached index on the first page,
then the search would fail because cached starting index was reused.
This change fixes both sides of the problem:
- Page::findItem shouldn't modify itemIndex argument if item is not found
- Storage::findItem should not reuse itemIndex between pages
Two tests have been added.
ref. TW8406
See merge request !171
New makefile component_wrapper.mk allows some variables to be set
before component.mk is evaluated. This properly fixes problems with
sdkconfig being hard to access in all phases of the build.
Including component_common.mk is no longer necessary and will print a
deprecation warning for components which use it.
Reduces number of make invocations, allows variables exported in project
to be seen in all component make processes, not just the main ones.
Also makes a no-op build about 3x faster than it was.
Fixes for github issues
This MR contains a bunch of small fixes for issues raised on Github and esp32.com forum:
- vfs doesn't check error code returned by open syscall
- spi_flash doesn't work when built in release mode
- duplicate definition of O_NONBLOCK when combining LwIP socket.h with sys/fcntl.h
- wrong order of creation of standard streams
- `_times_r` returning incorrect values, causing `clock`to return double of the actual time
- driver/gpio.h: comment fix
- wifi event handlers: fix incorrect MAC address printed by logging statements
- move some functions out of IRAM when compiling for bootloader
Please check commit descriptions for links to issues/forum posts and more details.
See merge request !183
newlib: fix compilation error when no timers are enabled in menuconfig
I have checked that three options (RTC/RTC+FRC1/FRC1) work, but didn't check "None" option.
This adds some missing ifdef blocks to remove "unused function/variable" warnings and fixes the use of `__errno_r` in a non-reentrant function.
See merge request !174
LwIP will define O_NONBLOCK in sockets.h if it isn't defined yet.
If sys/fcntl.h is included after socket.h, there will be duplicate definition.
Work around by including sys/fcntl.h into lwipopts.h.
https://github.com/espressif/esp-idf/issues/75
esp32/make: add detailed return error code for wifi APIs
1. Add detailed return error code for wifi APIs
2. Add description about error code in esp_wifi.h
3. Modify esp_wifi_reg_rxcb to esp_wifi_internal_reg_rxcb
4. Modify esp_wifi_set_sta_ip to esp_wifi_internal_set_sta_ip
5. Mark system_init as deprecated API
See merge request !187
1. Add detailed return error code for wifi APIs
2. Add description about error code in esp_wifi.h
3. Modify esp_wifi_reg_rxcb to esp_wifi_internal_reg_rxcb
4. Modify esp_wifi_set_sta_ip to esp_wifi_internal_set_sta_ip
5. Mark system_init as deprecated API
wpa_supplicant: replace pre-built crypto library with source code
This change replaces libcrypto.a pre-built library with source code from wpa_supplicant.
For now i've decided to keep the modified layout of source and header files which is used in the esp32_rtos_sdk_core project. This will make it easier to move other parts of wpa_supplicant from esp32_rtos_sdk_core into esp-idf. Once we move everything, we can rearrange the files and upgrade wpa_supplicant to latest version.
See merge request !177
1. remove "\n" when calling ESP_LOGX APIs.
2. modify uart_event_t for uart rx data.
3. use MICRO for uart inverse value
4. add uart_tx_data_t for internal tx function.
1. add new example for A2DP and the related btif layer source code is ported
2. modification on osi_alarm_new API to support periodic timer
3. enable macro BTA_AR_INCLUDED, BTA_AV_INCLUDED, BTA_AV_SINK_INCLUDED
4. The A2DP example cannot work and can only be built successfuly
1. Set XXX_TAG static, remove extern XXX_TAG in uart.h/ledc.h/gpio.h
2. I removed uart_set/get_print_port() functions, these functions are not well tested, I removed them for now.
3. Modify some function names for uart_read/write_bytes
4. Modify uart_write_bytes and uart_write_bytes_with_break.
1. fix bug in ringbuffer.c:
When return an dummy item, free_ptr might exceed rd_ptr, so the write_ptr would overwrite rd_ptr in this case.
2. Delete UART tx task in buffer mode. UART ISR will copy the data from tx buffer to fifo.
When read caching was added, Page::findItem started modifying itemIndex reference argument even if item wasn't found.
Incidentally, Storage::findItem reused itemIndex when starting search at next page.
So,
- if the first page had a cached index (findItem was called for that page), and it pointed to a non-zero index,
- first page has a few empty items at the end (but is marked full),
- next search looked up the item on the second page,
- index of the item on the second page was less than the cached index on the first page,
then the search would fail because cached starting index was reused.
This change fixes both sides of the problem:
- Page::findItem shouldn't modify itemIndex argument if item is not found
- Storage::findItem should not reuse itemIndex between pages
Two tests have been added.
implement time syscalls
This change adds optional support for libc time functions.
New menuconfig option allows selecting FRC1, RTC, both, or none to be used for timekeeping.
- If only FRC1 timer is used, gettimeofday will provide time at
microsecond resolution. Time will not be preserved when going
into deep sleep mode.
- If both FRC1 and RTC timers are used, timekeeping will
continue in deep sleep. Time will be reported at 1 microsecond
resolution.
- If only RTC timer is used, timekeeping will continue in
deep sleep, but time will be measured at 6.(6) microsecond
resolution. Also the gettimeofday function itself may take
longer to run.
- If no timers are used, gettimeofday function will return -1 and
set errno to ENOSYS.
`times` function returns time derived from FreeRTOS ticks. It reports all as 'system' time, 'user' time is reported as zero.
`settimeofday` function may be used to set current time.
LwIP SNTP module is hooked up into the system through `settimeofday`/`gettimeofday`.
Example demonstrating this functionality is also added.
ref. TW6415
See merge request !168
Deep sleep: Any source named rtc_wake_stub* is linked as RTC wake stub code
Also move esp_deepsleep.h documentation out to docs/deep-sleep-stub.rst
See merge request !142
Fix spi_flash_write regression and nvs error recovery
In the previous set of changes related to spi_flash, new alignment checks were added. One of these checks, word alignment of `src` buffer in `nvs_flas_write`, was unnecessary. ROM `SPIWrite` function can handle unaligned source buffers.
This change caused an error to be returned to nvs for some legitimate write operations. Due to a bug in nvs, further write operations were possible, while the internal state of `Page` instance was broken. In WiFi functional tests, this inflicted havoc on the nvs partition, creating multiple duplicate items in the affected page. Because multiple duplicate items per page were never supposed to be handled during page load, duplicates were not removed. Thankfully this caused an assert at a later point in the loading process, otherwise this bug would be very difficult to detect.
This change set fixes the original spi_flash regression, handling of `INVALID` state of `nvs::Page`, and handling of duplicate items.
See merge request !161
Feature/tw8155 optimize tx flow control
1. Remove TX flow control in LWIP
2. Make the return value of esp_wifi_internal_tx consistent with LWIP error code
See merge request !164
146f5962 - Make the return value of esp_wifi_internal_tx consistent with LWIP error code so that
the up-layer can detect the out-of-memory error and take action accordingly, such do flow control.
1. Add a ring buffer for UART TX.
If the buffer size is set to zero, driver will not use a buffer. But we need a task to send data from buffer to fifo. I tried directly copy data in ISR, but the code looked too long for ISR.
2. Modify the format in uart.h
Due to previous flash write bug it was possible to create multiple duplicate entries in a single page.
Recovery logic detected that case and bailed out with an assert.
This change adds graceful recovery from this condition.
Tests included.
lwip: fix tcp rx abnormal issue(tw8242)
In tcp_alloc(), initialize per_soc_tcp_wnd before initializing recv_wnd because recv_wnd depends on per_soc_tcp_wnd.
See merge request !160
Currently a restart is required to recover a page from invalid state.
The long-term solution is to detect such a condition and recover automatically (without a restart). This will be implemented in a separate change set.
Previously the test bench would check failure recovery by introducing error after each write operation.
This makes checks a bit more extensive (and much longer) by failing after every word written. Surprisingly, this change didn't expose any bugs.
ROM SPIWrite routine can work with unaligned sources, so this check is unnecessary.
Furthermore, it breaks nvs_set_str and nvs_get_blob when data pointer is unaligned.
Also fix stray backslash in COUNTER_STOP macro
nvs: fix memory leaks in HashList and nvs_close
Fixes TW8162.
Associated test case is run under Instruments on macOS, until I set up valgrind to test this automatically on Linux.
See merge request !150
Add cross-core int to accelerate task being awoken from another CPU.
This adds a per-CPU interrupt that can be used to poke the CPU to go do something. In this case all that is implemented is a request to yield the current task, used in case a CPU unblocks a task that runs on another CPU. This gets rid of the limitation that inter-CPU communication using queues, muxes etc can take up to a FreeRTOS tick to happen.
Specs!
Sending an in in a queue of length 1 (essentially a semaphore) as quickly as possible (just a small delay in the sender, to make sure the receiver task gets swapped out) for 10 seconds. Number indicates the amount of ints transferred
Old code:
CPU0->CPU0: 42986
CPU0->CPU1,: 2999
New code:
CPU0->CPU0: 42868
CPU0->CPU1: 62073
See merge request !155
Fix the things that broke when adding the new WDTs
Seemingly, I broke a bunch of things when adding the interrupt WDTs and moved the panic handler to the esp32 directory. This fixes that, as well as the issue where flashing would trigger the int wdt. It also bodges in a fix for a merge artifact breaking the halt-on-first-thread-when-openocd-is-connected; that fix should be refined later.
See merge request !157
lwip: support max 16 sockets
Since the customers need more sockets in their application, support max 16 sockets,
in other words, the total socket number of UDP/TCP/RAW sockets should not exceed 16.
See merge request !156
1. change the description of Makefile.projbuild
2. remove the license header in the API document
3. add private inlcuding header code in the components file
Since the customers need more sockets in their application, support max 16 sockets,
in other words, the total socket number of UDP/TCP/RAW sockets should not exceed 16.
This implements esp_partition_read, esp_partition_write, esp_partition_erase_range, esp_partition_mmap.
Also removed getters which didn't add much sugar after all.
spi_flash_read and spi_flash_write currently have a limitation that source and destination must be word-aligned.
This can be fixed by adding code paths for various unaligned scenarios, but function signatures also need to be adjusted.
As a first step (since we are pre-1.0 and can still change function signatures) alignment checks are added, and pointer types are relaxed to uint8_t.
Later we will add handling of unaligned operations.
This change also introduces spi_flash_erase_range and spi_flash_get_chip_size functions.
We probably need something like spi_flash_chip_size_detect which will detect actual chip size.
This is to allow single application binary to be used on a variety of boards and modules.
- spaces->tabs in tasks.c
- update vfs_uart.c to use per-UART locks
- add license to vfs_uart.c
- allocate separate streams for stdout, stdin, stderr, so that they can be independently reassigned
- fix build system test failure
- use posix off_t instead of newlib internal _off_t
- spaces->tabs in tasks.c
- update vfs_uart.c to use per-UART locks
- add license to vfs_uart.c
- allocate separate streams for stdout, stdin, stderr, so that they can be independently reassigned
- fix build system test failure
Feature/wdts
This adds two watchdogs to esp-idf:
- An interrupt watchdog. Kicks in if the FreeRTOS timer interupt on either the PRO_CPU or (when configured) the APP CPU isn't called for a configurable time. Panics, displaying which CPU caused the problem and the registers that may lead to the offending code.
- A task watchdog. A task has to feed it every once in a while. If not, it will print the name of the offending tasks, as well as the tasks currently running on both CPUs, and optionally panic.
Also adds a panic reason to the panic call, as well as fixes the panic code a bit.
See merge request !148
lwip: refactoring for lwip
1. All espressif specific code are prefix with ESP_
2. Define all ESP_ options in lwipopts.h
3. Remove useless code added in 8266
See merge request !154
The customers need to get information about AP that associated with ESP32 station,
these information includes RSSI, channel number etc, so add this new API
Feature/refractor for some wifi ap is
1. Modify esp_wifi_get_station_list to esp_wifi_ap_get_sta_list
2. Modify tcpip_adapter_get_station_list to tcpip_adapter_get_sta_list
3. Remove esp_wifi_free_station_list
4. Remove tcpip_adapter_free_station_list
5. Modify related data struct accordingly
6. Move soft watchdog from wifi lib to IDF
See merge request !152
1. Modify sta to station in comments
2. Modify esp_wifi_get_ap_num to esp_wifi_scan_get_ap_num
3. Modify esp_wifi_get_ap_list to esp_wifi_scan_get_ap_records
1. Modify comments for esp_wifi_internal_tx
2. Fix delay time error in esp32_tx_flow_ctrl which is found in code review,
modify _wait_delay init value from 0 to 1
6ce01d76: rename some wifi internal APIs
aa4d2aa9: last rx buffer is reserved for mgmt frame
bb0ff4a8: tw7775 fix assert when rx auth frame before create bss
component/tcpip_adapter: not update dhcps status when it is stopped after mode switch
When switch the mode from WIFI_MODE_STA/WIFI_MODE_NULL to WIFI_MODE_AP/WIFI_MODE_APSTA,
if the dhcp server is STOPPED, then dhcp server will not start automatically.
See merge request !147
When switch the mode from WIFI_MODE_STA/WIFI_MODE_NULL to WIFI_MODE_AP/WIFI_MODE_APSTA,
if the dhcp server is STOPPED, then dhcp server will not start automatically.
1. Use esp_log API for LEDC and GPIO code.
2. Modify some API return value.
3. Add ledc_set_pin() for LEDC
4. Modify typo in uart.h
Questions: In uart driver ISR handler, I used xxxFromISR , like xSemaphoreGiveFromISR, do those FromISR functions need to be put in IRAM?
Feature/trax
Add Trax support to esp-idf. OpenOCD already has trax support, this allows an esp-idf program to also trigger this when needed. Also included: some more logic to correctly reserve memory blocks for Trax.
See merge request !73
Add menuconfig setting for optimization level
This change adds two options (Debug/Release) for optimization level.
- Debug (default) enables -O0
- Release enables -Os and adds `-DNDEBUG`, which removes all assert() statements
These options may be overriden at project level by adding necessary flags to CFLAGS/CXXFLAGS.
Debugging symbols are kept in both cases, although we may add an option to strip output file if necessary.
Also we used to define all common compiler flags in CPPFLAGS, and then prepended them to CFLAGS/CXXFLAGS.
It made it impossible to add preprocessor macros to CPPFLAGS at component level (one had to use CFLAGS/CXXFLAGS instead).
Some third party libraries are not compatible with this approach. Changed to the more common way of using these variables.
CI will build both debug (default) and release.
See merge request !138
1. (^)TCPIP_DHCP_0101, (^)TCPIP_DHCP_0301: IDF set IP 0.0.0.0 may return error, don't check the result of setting IP to 0.0.0.0;
2. rename (^)TCPIP_DHCP_0102 to (^)TCPIP_DHCP_0212 as it's a DHCP server test case;
3. (^)TCPIP_TCP_0204,(^)TCPIP_TCP_0210,(^)TCPIP_UDP_0201,(^)TCPIP_UDP_0202: recv thread can't be deleted, change case to not create recv thread when create socket ;
4. (^)TCPIP_TCP_0206,(^)TCPIP_TCP_0212: query TCP server status format changed.
5. WIFI_SCAN_0301: check command error and test environment not correct
6. WIFI_SCAN_0302, WIFI_SCAN_0303, WIFI_SCAN_0304: test environment not correct
1. unsupported cases by "phy" command
2. DHCP server behavior different from ESP8266
3. TCP failed cases causes by unstable TCP behavior
4. UDP failed cases by poor UDP performance
This change adds two options (Debug/Release) for optimization level.
Debug enables -O0, release enables -Os and adds -DNDEBUG (which removes all assert() statements).
Debugging symbols are kept in both cases, although we may add an option to strip output file if necessary.
Also we used to define all common compiler flags in CPPFLAGS, and then appended them to CFLAGS/CXXFLAGS.
It makes it impossible to add preprocessor macros to CPPFLAGS at component level (one has to use CFLAGS/CXXFLAGS instead).
Some third party libraries are not compatible with this approach. Changed to the more common way of using these variables.
2.modified the thread.h file==> added the profile task event in it
3.modified bt_prf_task.c==>added the ready function in it
4.added the bt_prf_sys.h file
5.remove the profile_sys.h file
Some small fixes
- Kill unused uxReturn in task.c, https://github.com/espressif/esp-idf/issues/48
- Line end conversion in gpio.c
- Move heap_alloc_caps.h so components can also use it
See merge request !135
add bt_prf_task.h for defined the data & struct used for the profile task
add prodile_sys.h defined the profile system data used for profile task
modified component.mk
1. test will be categorized by test level
2. add test level as attribute to test cases
3. will select TestCaseScript by the test cases added to CI (currently no test case uses test case script)
4. adding test level to test jobs
5. update .gitlab-ci.yml, each job need to set its test case file path
6. update .gitlab-ci.yml, test case path for test report is changed to idf_test
1. night jobs should exit without error if not triggered
2. remove get wifi connect status cases from IDF
3. use Env tag to check if test environment is special
* master: (117 commits)
build system: Add -fno-rtti when compiling C++ code
FreeRTOS KConfig: Limit tick rate to 1000Hz
bootloader: Fix accidental tabs introduced in !78
build system: Print a WARNING if any submodule is out of date
Fix stack overflow message format
'make flash' targets: Print serial port when flashing
lwip/esp32: support iperf
Add data memory for RMT peripheral
syscall write: Should return number of bytes written
Also push relevant tags over
esp32: add libsmartconfig.a to link libs
esp32: not link wps
esp32/lib: update wifi lib to a1e5f8b9
esp32: remove esp_wps.h
add smartconfig header files(merge this after updating libsmartconfig.a version v2.6.2)
esp32/lib: update wifi lib to 3853d7ae
Add Comments
Modify spinlock error in periph_ctrl.c
Define xcoreid offset, add warning in tcb struct wrt the need to also change that define when struct changes
components/tcpip_adapter: add some comments
...
# Conflicts:
# components/freertos/queue.c
# components/freertos/tasks.c
>1000Hz breaks portTICK_PERIOD_MS (see gitlab 4)
A working >1000Hz tick rate is possible with some changes, but beyond a
certain point it's dimishing returns to preempt tasks this often.
lwip/esp32: support iperf
1. Add _exit() definition in syscalls.c
2. Fix a bug in sockets.c on which iperf depends
I'm now investigating performance of esp32, need iperf to be merged in to master branch for convience
See merge request !136
1. add libphy.a librtc.a, but store in bt submodule, if someone use them, please copy to esp32/lib/ instead the origin one
2. add 07_blufi demo
3. change esp32/Kconfig to allow bt/wifi coexist
esp32: Bootloader wake deep sleep stub
App can contain a stub program resident in RTC fast memory. Bootloader
will load the stub on initial boot. If the device wakes from deep sleep,
the stub is run immediately (before any other data is loaded, etc.)
To implement a custom wake stub, implement a function in your program:
```
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
esp_default_wake_deep_sleep();
// other wake logic
}
```
... and it will replace the default implementation.
See merge request !78
We reserve 4KB Slow RTC memory to save RF calibation result and BT NVS data.
If not all these Slow RTC momory Blocks are used, we will open the other parts.
Workaround: Automatically pin no-cpu-affinity task to a core when FPU is used
FPU status at the moment does not migrate cleanly between cores, so tasks without affinity that happen to migrate across FPUs will run into problems. As a workaround, this modification will automatically pin the task to the current CPU when FPU activity is detected. If anything, it's better than getting all kinds of weird and wonderful FPU corruption issues...
See merge request !124
Assert on untested FreeRTOS features
When I SMP-enabled, I went through all the functions and made the necessary modifiucations. I however only managed to test the most used functions thoroughly. While we should test all FreeRTOS functions eventually, this MR will mark the ones we have not tested yet with a macro call that will, if enabled in MenuConfig (default enabled) assert() when the untested function is called.
Also removes some superfluous mux initializion code in EventGroups code.
See merge request !120
1. configure LEDC timer saparately
2. add peripher_crtl.c/.h
To enable the peripheral modules, we have to set/clear the control register in dport_reg.h.
These bits are disabled by default and they are all in a same register, so we need to add a lock on that.
3. add include esp_err.h in gpio.h
component/bt: update libbtdm_app.a
1. update the lib to version 010102 because the branch feature/btdm_controller missed the lib
See merge request !122
App can contain a stub program resident in RTC fast memory. Bootloader
will load the stub on initial boot. If the device wakes from deep sleep,
the stub is run immediately (before any other data is loaded, etc.)
To implement a custom wake stub, implement a function in your program:
```
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
esp_default_wake_deep_sleep();
// other wake logic
}
```
... and it will replace the default implementation.
* master:
app_main: Return type to void
wifi: move type definitions into separate header file
wifi: use default esp_event_send handler in WIFI_INIT_CONFIG_DEFAULT
nvs: Remove flash layout arguments from nvs_init()
Add contributor agreement, update CONTRIBUTING file
Update http_request & https_request examples for new startup flow
Add very simple "hello world" & "blink" examples
Build examples out-of-tree as part of CI process
Examples: Use event groups for waiting until WiFi is associated & ESP has IP
BT example: Enable BT stack in config by default
BT: Relink component on new BT library, auto-initialise submodule if missing
Documentation: Add contributor guide, expand README & add an examples README
Update gitignore for examples
examples: Add https_request example
mbedtls: Add some initial menuconfig options
examples: HTTP request example
component/esp32: udpate wifi lib
component/esp32: modify bool argument name from enable to en
component/esp32: adjust some APIs
esptool: Bump upstream revision
1. move the app demo code to example
2. move the header files to correct path
3. move profile to profiles directory and seperate esp&std
4. some other codes
5. needs continue to cleanup the code
esptool: Bump upstream revision
Fixes github #14 (unexpected errors writing to DIO flash)
Also speed boost when writing compressed data (can now go via stub)
See merge request !103
* master: (32 commits)
components/nghttp: rename Makefile to component.mk
components/nghttp: add HTTP2.0 protocol feature
compoenents/esp32: don't alias start_cpu1 to start_cpu0_default
components/freertos: fix a bug with an uninitialised return value
Change application entry point name back to app_main
gitlab-ci: build SSC with matching branch name, if available
components/spi_flash: remove stray level of indentation
components/nvs: fix broken sentences in comment blocks
components/esp32: fix renaming of esp_event_set_cb, minor clean up
components/esp32: remove "_user" part from entry points, weaken start_cpu0/1
Fix a spelling mistake in panic message, add carriage return to stack canary message
components/lwip,esp32: fixes for C++
components/bt: fix compilation, remove ./ from makefile
components/esp32: clarify type of queue in wifi_init_config_t, add default init macro
components/esp32: add ESP_ERROR_CHECK
Event handling refactoring
clean up warnings
components/esp32,bt: fix typos in comments
Startup flow refactoring
Roll back submodule version
...
While this may reduce esp_wifi.h file readability for people who don't have a "go to definition" function in their editors, this is needed to decouple esp_wifi and esp_event headers, and possibly other headers which may use wifi types in the future.
Startup flow refactoring
This set of commits changes the startup code in a way that lets the application choose if/when to initialize WiFi/BT.
Application entry point is now a more familiar `main()` function. This function is executed in its own task. Application may choose to do some initialization from main function, create some tasks and then return from `main`. Simple applications may choose to do all their work from `main`.
Additionally this MR splits event handling code into two parts.
- One part is a set of standard handlers for WiFi and DHCP events. Most applications will use this set of handlers, and it is made available via new `esp_event_process_default` function.
- Another part is the default implementation of event handling loop. Some applications may choose to use default event loop through `esp_event_loop_` set of APIs, which start an event handling task and call user-provided event callback from this task. Other applications may create an event queue and implement event loop themselves. In this case application has to provide `esp_event_send` function. In this case the implementation provided by `esp_event_loop_` module is unused.
esp-idf-template has been updated to match this set of changes: https://github.com/espressif/esp-idf-template/tree/feature/init_refactoring
BT example has also been updated.
We need to provide examples of both event handling approaches. This will be done in a separate follow-up MR.
See merge request !112
Fix a spelling mistake in panic message, add carriage return to stack canary message
Probably the most trivial mr ever, but the spelling error was reported as a bug and the missing \r bugged me ever since I saw it.
See merge request !113
* master:
components/spi_flash: remove stray level of indentation
components/nvs: fix broken sentences in comment blocks
Roll back submodule version
Spinlocks already come initialized. Remove the code that would essentially re-initialize them at runtime
Remove all references to prvLockQueue / prvUnlockQueue
components/esp32: clean up unused function warnings in single core mode
clean up warnings
components/nvs: fix build, use log library instead of printf
components/spi_flash: add flash operation counters option to Kconfig
components/nvs: add erase function
components/nvs: fix formatting
components/nvs: batch writes when possible
components/spi_flash: add performance counters
components/nvs: maintain item hash list at page level
components/nvs: avoid reading just-erased page
# Conflicts:
# components/esp32/cpu_start.c
# components/esp32/event_default_handlers.c
nvs: speed improvement and erase APIs
NVS initialization speed issue raised in https://ezredmine.espressif.com/issues/6881 has been addressed for single core mode through optimization of `spi_flash_*` routines. This MR addresses same issue for dual core mode.
- An index table is added at Page level, it allows doing fast search of item index based on key name and namespace. This heavily reduces the number of flash reads.
- Write operations are batched when writing/erasing long variable-length values (str and blob). This gives a 33% reduction in the number of writes for a 64-byte value, 50% reduction for a 96-byte value.
- Add optional (configurable via menuconfig) perfomance counters for spi_flash APIs
With these changes, total init time for NVS goes down from 2 seconds to 140 ms.
Additional RAM usage is 128-640 bytes per page, depending on content. Typical RAM usage for current use case (storing wifi configuration parameters) is 256 bytes.
This change also exposes APIs to erase single key or the whole namespaces, needed for https://ezredmine.espressif.com/issues/6769.
See merge request !105
Clean up warnings and remove unused parts of FreeRTOS
For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.
Additionally prvLockQueue/prvUnlockQueue have been removed, dragging some other bits of FreeRTOS along.
Original issue: https://github.com/espressif/esp-idf/issues/18
See merge request !111
- put contents of a few headers into c++ guard blocks
- fix off-by-one error in do_global_ctors
- remove system_init from startup code (should be called from main)
This change separates definitions in esp_event.h and functions in event.c into several parts:
- event structure definitions (esp_event.h)
- default implementations of event handlers (event_default_handlers.c)
- default implementation of event loop (event_loop.c, esp_event_loop.h)
Purpose of this change is to allow applications choose their own poison:
- full control of event loop at the expense of more bootstrap code
- pre-defined event task firing event callbacks, but less code in app_main.c
For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.
Only remaining warning is in FreeRTOS queue.c, and it may be a useful one.
This change removes implicit WiFi/BT initialization from startup code.
"main" task is started once essential part of startup code is complete.
This task calls application-provided "int main(void)" function, which can call WiFi/BT init functions if necessary.
1. add SSL session new and free function
2. add SSL session peer cert get and free operation
3. above all, change low-level cert object to be object point not object
For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.
Only remaining warning is in FreeRTOS queue.c, and it may be a useful one.
Introduces new internal function, Page::alterEntryRangeState, which gathers changes to multiple elements of entry state table into a single write, provided that these changes fall into a single word. This allows changing state of up to 16 entries in a single write.
Also adds new function, writeEntryData, which writes the whole payload of SZ and BLOB type entries in one go, instead of splitting it into multiple 32-byte writes.
This reduces number of writes required for SZ and BLOB entries.
1. add empty function to load private key into SSL context
2. add empty function to load certification into SSL context
3. add function to load RSA private key
1. add openssl 'new' and 'free' function
2. add clear unused variate to void warning to appear when compile
3. add internal function 'X509_new' to take the place of 'sk_X509_NAME_new_null' function whitch is openssl stack function
This feature allows to use static buffers (or from a pool of memory which is not
controlled by FreeRTOS).
In order to reduce the impact of the changes, the static feature has only been added
to the queus (and in consequence to the semaphores and the mutexes) and the tasks.
The Timer task is always dynamically allocated and also the idle task(s), which in the
case of the ESP-IDF is ok, since we always need to have dynamic allocation enabled.
lwip: add debug code to show udp/tcp pcbs
Add code to show all tcp/udp pcbs, these kind of debug info is helpful for lwip issue debugging.
See merge request !98
* 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
Add logging library
Logging library, intended to be used across other components.
Uses design similar to Android NDK logging APIs and allows for both compile time and run time filters, similar to logcat.
Also includes cleanup of cpu_startup.c — i was changing some logging output in this file so decided to re-format it and reduce code duplication.
Ref TW6703
See merge request !68
* branch 'master':
components/freertos: override per-task __cleanup handler to close stdin, stdout, stderr
gitlab-ci: allow running tests for branches, triggered via API
Enable SO_REUSEADDR in LWIP
Daniel initially asked me why this wasn't enabled, and I don't think I got any reasons against enabling this. If any, it makes porting existing software easier. Tuan needs it for UDP multicast as well.
Code changes are by Tuan: basically the enable for SO_REUSEADDR in LWIP as well as a bugfix in a bit of mbedTLS that gets enabled.
See merge request !90
Move CPU region protection setup into soc/cpu.h
change tabs to spaces
remove unused extern declarations
use RTC_WDTCONFIG0 instead of numeric address (still need to fix BB reg)
This also removes logging implementation from bootloader and replaces it
with the one provided by the log component. Some occurrences of printf
and ets_printf have been changed to ESP_LOGx APIs.
Note that with WiFi stack enabled, system_init will reset frequency to 240MHz.
To make this setting useful, esp32-wifi-libs submodule needs to be updated.
esp32/lib: update to 1303c92c
1. support to set vendor ie;
2. fix "mode:" log twice issue; TW7019
3. fix station can not connect to some AP in WEP mode; TW7021
See merge request !85
Function declaration should only be included if MBEDTLS_SHA512_ALT is
not set. This matches sha1.h and sha256.h
This change should be contributed back upstream to mbedTLS project.
* branch master: (51 commits)
fix typos
callback: add a void* pointer with each callback
header: callbacks use "void *" as arguments
header: format and fix typos
add wifi api comments
add wifi api comments
components/spi_flash: call SPIUnlock only once
components/spi_flash: improve comments and readability
esp32 cpu_start: Include rom/uart.h, remove inline ROM function declarations
bootloader: Add bootloader Kconfig
Fix bug where nesting vTaskEnterCritical calls would not re-enable interrupts after vTaskExitCritical sections.
installed gitlab key in global before_script, don't need to overwrite in template before_script
ci: Use github repo for wifi libraries on master branch, gitlab repo otherwise
components/esp32,spi_flash: update some comments
components/esp32: remove dependency of WIFI_ENABLED on FREERTOS_UNICORE
esp32/lib: Bump WiFi revision
update ci: build ssc with idf submodule wifi lib
components/esp32: add inter-processor call API and implement spi_flash through it
add MACRO to get flash pad number from efuse value
add comments to register read/write operations
...
lwip: add socket tx flow control
This fix is used to solve wifi q full issue:
1. When wifi tx q is full, set tx_enable to false
2. When wifi tx q decrease 1/2 max length, set tx_enable to true again
3. esp_wifi_tx_enable return whether tx_enable is true
4. If esp_wifi_tx_enable return false, socket will be blocked
See merge request !62
This fixes the performance impact for spi_flash_write and spi_flash_erase.
With this change, NVS init in single core mode takes about 50ms (compared to >2seconds before that).
Dual core compatible spi flash APIs
Implementation of spi flash APIs which work in dual core mode.
This also includes other changes:
- fixes to FreeRTOS tasks.c made by Jeroen and me — these were originally made to fix issues with high priority tasks seen in WiFi stack, but were required to get stuff in ipc.c working as well
- initial base idea with two high-priority tasks was separated into a separate API — esp_ipc.h. That API allows one to run a function on the other CPU from a high-priority task. Because we don't have preemption across CPUs, this is currently not very fast: it requires on average half a tick until the second CPU switches to the high priority task. Currently that API can be either blocking, or non-blocking with queue length of 1. I haven't yet found a use case for arbitrary sized queue of IPC requests. Anyone who needs that can trivially add that later by replacing a binary semaphore with a generic queue.
With these changes i can run application with WiFi stack and NVS on both cores.
See merge request !25
1. timer reg file for both time group 0 and time group 1, not only timer group 0
2. fix bug that io mux header file mismatch with chip
3. fix bug that some BASE address not correct
4. add some static function to eagle.fpga32.rom.addr.v7.ld
5. add interrupts usage table
6. add some comments for rom code functions
* master: (130 commits)
lwip: Define LWIP_ESP8266 in port lwipopts.h not gcc command line
CI: Build the esp-idf-template with the matching branch name, if it exists
README: Add Resources section with some links
Rename README.buildenv to docs/build_system.rst and ReST-ify it
Eclipse docs: Easier to just replace entire PATH, msys32 has everything we need to build/flash
test_build_system: Print ESP_IDF_TEMPLATE_GIT for easier debugging
Name component makefiles component.mk instead of Makefile
Eclipse doc: Add troubleshooting note about Makefile directories
eclipse_make.sh: Fix printing of make directory
Move bin/eclipse_windows_make.sh to tools/windows_eclipse_make.sh
Eclipse docs: Prepend IDF paths to beginning of PATH
Set default SPI flash access mode to DIO
FreeRTOS: temporary solution for memory canaries and memory debug
tcpip_adapter: fix dhcp client work flow
event: not post got ip event if static is invalid
tcpip_adapter: typedef clean up
event: post got ip event when use static ip
tcpip_adapter: use dhcp callback to post got ip event
dhcp: add dhcp callback
lwip: remove netif_reg_addr_change_cb
...
Used by mbedTLS to set MBEDTLS_CONFIG_FILE in all components.
This change sets CFLAGS/etc at the project level and then exports those
variables for components, rather than setting them independently each time
a component Makefile is invoked.
Eclipse fixes, including renaming component Makefiles to component.mk
Some changes after following up some Eclipse problems with @nilay .
Biggest thing is renaming all component Makefiles to component.mk. This requires changes to all esp-idf projects, ie:
* https://github.com/espressif/esp-idf-template/compare/bugfix/docs_eclipse?expand=1
* http://gitlab.espressif.cn/idf/esp-idf-tests/tree/update/component_makefiles
... this fixes Eclipse weirdness and also means the only "Makefile"s in the project are the ones you should run make against.
If this MR is merged then I'll also merge these, email all developers about the breaking change and post on esp32.com.
See merge request !34
Set default SPI flash access mode to DIO
We have a bunch of boards out there (the NodeMCU-lookalike, breadboardable boards) in the hands of early reviewers. Because the flash chips on these boards have a different command to go into QIO mode, ESP-IDF will break on these boards out of the box. Eventually, we need some nifty way to autodetect this or something, but for now, the quick fix is to make DIO the default access mode.
Once this is merged, I will also modify the default in the template apps sdkconfig.
See merge request !65
Should protect against concurrent use of hardware crypto primitives,
with good performance.
Not necessary to call esp_aes_acquire_hardware(),
esp_sha_acquire_hardware(), etc when using these APIs. These are
provided for external users calling the hardware crypto hardware
directly, to coexist with this implementation.
Fixes problems with Eclipse trying to build in directories it shouldn't.
This is a breaking change for existing repositories, they need to rename
any component Makefiles to component.mk and rename their references to
$(IDF_PATH)/make/component.mk to $(IDF_PATH)/make/component_common.mk
FreeRTOS: temporary solution for memory canaries and memory debug
1. This is just a temporary solution, it will be removed when umm_malloc is ready
2. Support memory canaries mechanism
2. Add debug code to show allocated memory info
See merge request !64
tcpip_adapter: got ip event stuff
Include:
1. add dhcp callback;
2. post got ip event in dhcp callback when dhcp bind;
3. tcpip_adapter typedef clean;
4. post got ip event in station connected event handler when use valid static ip;
TW6926
See merge request !61
1. This is just a temporary solution, it will be removed when umm_malloc is ready
2. Support memory canaries mechanism
2. Add debug code to show allocated memory info
Since esp32 has much more memory than esp31B, modify the HEAP_HIGHWAT from
6K to 20K.
Notes: HEAP_HIGHWAT is used for tcp/udp tx flow control, if socket task detects
that the free heap memory is less than HEAP_HIGHWAT, it stops to trasmitting until
the free heap memory is greater than HEAP_HIGHWAT
1. Add the parameter type of api esp_wifi_set_storage.
2. WIFI_STORAGE_RAM means storing profiles in ram. WIFI_STORAGE_FLASH means storing profiles in flash.
Fix: Return after setting breakpoint when ocd is detected instead of continuing …
…into the panic routine
Made a small thinko when refactoring the panic handler code. This fixes it.
See merge request !36
The parameter aid followed -a is aid of the connected station. If aid is 0, kick out all of the connected stations.
2. Add block parameter to api esp_wifi_scan_start.
If block is true, the api blocks before scan done or returns directly.
components/expat: add XML parse feature
Develop and Compile XML Parse based on XMPP protocol, can test from unity running list, see expat file.
See merge request !32
found small mistake in it
we have:
PROVIDE ( ets_aes_crypt = 0x4005c9b8 );
PROVIDE ( ets_aes_disable = 0x4005c8f8 );
PROVIDE ( ets_aes_enable = 0x4005c8cc );
PROVIDE ( ets_aes_set_endian = 0x4005c928 );
PROVIDE ( ets_aes_setkey_dec = 0x4005c994 );
PROVIDE ( ets_aes_setkey_enc = 0x4005c97c );
Signed-off-by: Ivan Grokhotkov <ivan@espressif.com>
Implement lwip per-thread-sem with:
vTaskSetThreadLocalStoragePointerAndDelCallback/pvTaskGetThreadLocalStoragePointer
register sys_thread_tls_free to free per-thread-sem when the thread is terminated.
Also let lwip use index CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX
2. Add struct station_list into tcpip_adapter layer
3. When ap -L cmd is received, get mac address from mac layer first and then search ip address based on mac address on dhcp layer.
update ld and heap region
Divide origin fpga ld to several lds, choose specific ld for normal/BT/Trace by menuconfig, change iram/dram len in ld to full use hardware ram region.
See merge request !28
Fix dualcore startup
This MR includes:
- a workaround for a hardware bug with cache initialization
- fix of `#if CONFIG_WIFI_ENABLED` block in cpu_start.c for the case when WiFi is disabled.
- removal of miscellaneous delays in cpu_start.c
See merge request !22
fix DRAM_ATTR attribute
Variables marked with DRAM_ATTR were not placed in any specific section and were appended to the last section, causing some errors at binary file generation stage.
This change places contents of .dram1 section into .dram0.data.
Also removes .iram1pro/.iram1app/.dram1pro/.dram1app which weren't used anywhere.
See merge request !23
Make: fix incremental builds, add build tests
Four semi-related build changes in one:
* Add basic tests for make system sanity (can be expanded as we find corner cases)
* Fix incremental building of bootloader when source files change
* Don't regenerate component libraries or re-link the ELF file if nothing changed
* Rename `$(vecho)` to `$(summary)` and add a new `$(details)` macro to echo some helpful build details when V=1.
See merge request !20
This is a workaround for a hardware bug with cache initialization.
Only two lines of code related to DPORT_APP_CACHE_MMU_IA_CLR were added around mmu_init(1); call,
and two lines at the end of comment block.
I reformatted surrounding lines to use spaces for indentation, like the rest of the code in this file does.
This change removes various delays in PRO and APP CPU startup paths.
Also some unused code and ets_printf statements are cleaned up or removed.
2nd CPU now communicates that it has started through a global variable.
The thread-local-storage feature in FreeRTOS attaches an application-usable array of pointers to a thread control block. These pointers usually point to a structure the thread allocates. When a thread gets (voluntarily or involuntarily) destroyed, this memory can leak. This merge adds a matching second array of user-settable pointers to destructor routines. As soon as the task gets cleaned up (which happens in the idle thread), the destructors get called and the memory can be freed.
See merge request !19
Add cr after a lf is printed (configurable)
Small menuconfig option to make the newlib stdout functions replicate the behaviour of ets_printf e.a. by sending out a \r before every \n.
See merge request !14
This commit fixes several issues with state handling in nvs::Page. It also adds extra consistency checks in nvs::PageManger initialization.
These changes were verified with a new long-running test ("test recovery from sudden poweroff"). This test works by repeatedly performing same pseudorandom sequence of calls to nvs_ APIs. Each time it repeats the sequence, it introduces a failure into one of flash operations (write or erase). So if one iteration of this test needs, say, 25000 flash operations, then this test will run 25000 iterations, each time introducing the failure point at different location.
rtos: change XT_CLOCK_FREQ from 13MHz to 80MHz
Freq has been change to `80MHz` in system_init, otherwise system tick will not be accurate now.
Maybe we can config freq by menuconfig.
See merge request !8