Commit Graph

227 Commits

Author SHA1 Message Date
Marius Vikhammer
6fb996b1ac newlib: revert back from spinlocks to using newlib locks for time.h
Spinlocks from spinlock.h do not disable the scheduler and thus cannot safely
be directly used as a locking mechanism. A task holding the lock can get
pre-empted, and at that point the new running task will also be allowed to
take the spinlock and access whatever it was protecting.

Another issue is that the task holding a spinlock could migrate to a different
core which in turn would cause the application to fail asserts. The current
implementation assumes the core that takes the lock is also the core that
releases it.

Closes https://github.com/espressif/esp-idf/issues/5762
2020-09-03 09:56:02 +08:00
Renz Bagaporo
c70c227591 esp_system: private system time functions for now 2020-08-11 17:52:36 +08:00
Renz Bagaporo
346cf4430d esp_system: introduce system time functions
- Introduce system time function and concept of system time provider.
esp_timer is system time provider when present.
- Set the reference point for system time, g_startup_time.
- Use the system time functions in newlib instead of calling esp_timer
functions directly
2020-08-10 15:12:38 +08:00
Renz Bagaporo
5785e4dfb6 newlib: move some functions to soc, esp32, esp32s2 2020-08-10 15:11:38 +08:00
Renz Bagaporo
a395a00d2c newlib: separate low-level code in time.c implementation 2020-08-10 15:11:37 +08:00
morris
2917651478 esp_rom: extract common ets apis into esp_rom_sys.h 2020-07-27 15:27:01 +08:00
Angus Gratton
442736c5d6 Merge branch 'refactor/common_rom_uart_apis' into 'master'
esp_rom: extract common uart apis into esp_rom_uart.h

See merge request espressif/esp-idf!9313
2020-07-21 15:24:21 +08:00
morris
345606e7f3 esp_rom: extract common uart apis into esp_rom_uart.h 2020-07-17 16:00:59 +08:00
Felipe Neves
11f6addc61 expression_with_stack: added a tweak on TCB stackpointers to avoid false trigger of stack overflow 2020-07-14 12:56:02 +00:00
Felipe Neves
a700035a85 test/shared_stack_printf: improved printf with shared stack function test 2020-07-14 12:56:02 +00:00
Felipe Neves
938a73756c esp_common/shared_stack: modifed the stack switch procedure to a simpler way
esp_common/shared_stack: refactored the implemenation of shared stack function (still not working properly)

esp_expression_with_stack: refactored the shared stack function calling mechanism and updated the documentation
2020-07-14 12:56:02 +00:00
KonstantinKondrashov
a861a75396 newlib: Fix UT for adjtime 2020-06-15 22:46:41 +08:00
KonstantinKondrashov
0c7e13f0cd newlib: Fix adjtime, returns the amount of time remaining from any previous adjustment
If the olddelta argument is not a null pointer, the adjtime function returns information
about any previous time adjustment that has not yet completed.

Closes: https://github.com/espressif/esp-idf/issues/5194
2020-06-08 22:57:38 +08:00
Angus Gratton
b2fe7f681e Merge branch 'bugfix/esp32_eco3_init_syscall_table' into 'master'
newlib: initialize syscall_table_ptr_app in single core mode

Closes IDFGH-3254

See merge request espressif/esp-idf!8596
2020-05-07 15:17:13 +08:00
Ivan Grokhotkov
aac3e56a9a newlib: initialize syscall_table_ptr_app in single core mode
ESP32 ECO3 ROM uses syscall_table_ptr_app on both CPUs, so the pointer
needs to be set if running in single core mode.
2020-05-04 10:55:34 +00:00
Francesco Giancane
1173ce32f6 endian.h: define non-standard symbols for endian handling
BSDs and Unices defined some non standardised functions and symbols used
for endianness handling: converting from Little Endian to Big Endian,
converting from Host to a specific representation, converting from a
specific representation to Host.

With this commit, a modified version of those symbols provided by
FreeBSD is imported.

The license of the imported code is still 2-Clause BSD.

Signed-off-by: Francesco Giancane <francesco.giancane@accenture.com>
Closes https://github.com/espressif/esp-idf/pull/4784
2020-04-29 23:47:51 +02:00
Francesco Giancane
6f8ce38f99 Introduce <endian.h> compatibility header
Programs and libraries using compiler and system information about
endianness often include the system header `<endian.h>`.

In `xtensa-gcc` compiler with `newlib` distribution, that file is located in
`<machine/endian.h>`; this means that `#include <endian.h>` would fail
at compile time.

This commit fixes the issue by adding a compatibility `<endian.h>`
header which in turn just includes `<machine/endian.h>`.

Signed-off-by: Francesco Giancane <francesco.giancane@accenture.com>
Merges https://github.com/espressif/esp-idf/pull/4784
2020-04-29 23:47:51 +02:00
Ivan Grokhotkov
cc1d287133 newlib: use --specs=nano.specs to enable "nano" version of C library
esp2020r1 toolchain includes a nano.specs file, which instructs GCC to
substitute libc.a with libc_nano.a.

In the build system, this simplifies handling of the nano formatting
option, eliminating LIBC and LIBM global variables.
2020-03-27 20:04:47 +07:00
KonstantinKondrashov
9aeac7f6cb esp_rom: Fix esp32.rom.newlib-time.ld should includes all time ROM functions/data
- Added UT
Closes: https://github.com/espressif/esp-idf/issues/4925
2020-03-27 04:57:42 +00:00
Angus Gratton
62426a6c90 Merge branch 'refactor/use_new_component_registration_functions' into 'master'
CMake: Use new component registration function

See merge request espressif/esp-idf!8068
2020-03-25 08:02:42 +08:00
Renz Bagaporo
3d0967a58a test: declare requirements and include dirs private 2020-03-23 10:58:50 +08:00
Ivan Grokhotkov
33d3bff196 newlib: don't require VFS 2020-03-20 14:03:45 +01:00
Ivan Grokhotkov
4cb10ea7c2 newlib: provide default implementations for more syscalls 2020-03-20 14:03:45 +01:00
Ivan Grokhotkov
1f1ce38e5f newlib: don't depend on VFS names when populating the syscall table 2020-03-20 14:03:44 +01:00
Ivan Grokhotkov
45e50f1f2a newlib: move dirent.h, ioctl.h headers from VFS 2020-03-20 13:43:42 +01:00
Ivan Grokhotkov
b427b23ae0 newlib: remove direct dependencies on VFS functions
poll: use "select" not "esp_vfs_select" move to newlib

pread, pwrite, select, utime: remove from newlib. VFS and/or LWIP will
provide aliases for these functions.
2020-03-20 13:43:42 +01:00
Renz Christian Bagaporo
af9b1131a3 esp_system: share abort panic with port layer 2020-03-10 19:56:24 +08:00
Renz Christian Bagaporo
2855bb6f0a newlib: move abort to newlib 2020-03-10 19:56:24 +08:00
Konstantin Kondrashov
739eb05bb9 esp32: add implementation of esp_timer based on TG0 LAC timer
Closes: IDF-979
2020-02-06 14:00:18 +08:00
Felipe Neves
429712c6eb freertos: moved all xtensa specific files into a separated folder 2020-01-27 16:05:30 -03:00
Ivan Grokhotkov
16e63f6a3f esp32s2: esp_rom: separate nano formatting functions, fix newlib tests 2020-01-23 18:07:37 +01:00
morris
405b0e7f06 esp_rom: splict libgcc and libc outof rom.ld bundle file 2020-01-23 00:27:47 +08:00
morris
e30cd361a8 global: rename esp32s2beta to esp32s2 2020-01-22 12:14:38 +08:00
Felipe Neves
8e5ea171d3 newlib: reverted support of memalign function 2020-01-10 10:05:28 -03:00
Felipe Neves
aa100d2dfe newlib: added heap_caps_aligned_alloc on bottom of memalign 2020-01-10 10:05:28 -03:00
Angus Gratton
bdf6c00154 Merge branch 'feature/likely_unlikely' into 'master'
Adding likely unlikely macros to hot code paths

Closes IDF-284

See merge request espressif/esp-idf!6368
2020-01-10 14:05:07 +08:00
Konstantin Kondrashov
2c793cef06 idf: Support a custom toolchain with time_t wide 64-bits
Allows resolving the Y2K38 problem.

Closes: IDF-350

Closes: https://github.com/espressif/esp-idf/issues/584
2020-01-10 12:58:54 +08:00
Angus Gratton
a39e8e5de9 Merge branch 'feature/asio_update' into 'master'
asio: updated ASIO port to use latest asio and esp-idf features

See merge request espressif/esp-idf!6623
2020-01-10 12:57:25 +08:00
David Cermak
b7ef7feaeb newlib: using lwip implementation of interface name/index conversion
Links https://github.com/espressif/esp-idf/issues/3557
2020-01-09 21:53:50 +01:00
David Cermak
13d603e486 asio: updated ASIO port to use latest asio and esp-idf features
closes https://github.com/espressif/esp-idf/issues/4296
2020-01-09 21:53:50 +01:00
Felipe Neves
57edda15a0 shared_stack: added minimal stack size for shared stack, configurable via menuconfig 2020-01-09 09:59:00 -03:00
Felipe Neves
5db46ab9e6 assert: extend likely macro to be called when silent assertions are off 2020-01-03 14:42:58 -03:00
Felipe Neves
1b76253e0e newlib/assert: placed unlikely macro as part of assertion
newlib/assert: replace unlikely with likely to keep original assertion

newlib/assert: fix assert macro that uses likely

freertos/port: add the missing sdkconfig.h back

newlib/assert: assert macro back to a single line
2020-01-03 14:42:55 -03:00
Angus Gratton
17b5df4d72 Merge branch 'feature/function_call_with_stack' into 'master'
esp_common: added a macro to allow call functions using user allocated stack

Closes IDF-535

See merge request espressif/esp-idf!6709
2019-12-31 15:08:27 +08:00
Ivan Grokhotkov
891eb3b020 freertos: save/restore PS and EPC1 around window spilling
Since in b0491307, which has introduced the optimized window spill
procedure, _xt_context_save did not work correctly when called from
_xt_syscall_exc. This was because unlike _xt_lowint1, _xt_syscall_exc
does not save PS and EPC1. The new version of _xt_context_save
modified PS (on purpose) and EPC1 (accidentally, due to window
overflow exceptions), which resulted in a crash upon 'rfi' from the
syscall.

This commit adds restoring of PS and EPC1 in _xt_context_save. It also
slightly reduces the number of instructions used to prepare PS for
window spill.

Unit test for setjmp/longjmp (which were broken by this regression)
is added.

Closes https://github.com/espressif/esp-idf/issues/4541
2019-12-27 11:27:01 +01:00
Felipe Neves
d1b76d13bb exp_expression_with_stack: added check for null pointer after obtaining a mutex in test 2019-12-20 13:28:29 -03:00
Felipe Neves
e4fb50e6f3 expression_with_stack_xtensa: fixed stack pointer to avoid its overflow on heap block metadata. 2019-12-20 13:18:13 -03:00
Felipe Neves
5e18cd4e13 esp_expression_with_stack: added watchpoint on stack parameter before use it 2019-12-20 13:18:13 -03:00
Felipe Neves
7b90f34c5a esp_expression_with_stack: renamed macro and functions to have esp_ prefix 2019-12-20 13:18:13 -03:00
Felipe Neves
98b76617be test_shared_stack_printf: moved the test stack inside the heap 2019-12-20 13:18:13 -03:00