Commit graph

2703 commits

Author SHA1 Message Date
Angus Gratton 9faf9c9416 newlib locks: Fix _lock_init() & _lock_init_recursive() failing to initialise a lock
If scheduler was running, and lock was an auto variable initialised at runtime by _lock_init*, initialisation could fail
if the lock variable held non-zero stack memory (and lock would be left invalid).

In other cases the lock is statically initialised to zero by __LOCK_INIT*
2017-06-29 19:46:19 +08:00
Angus Gratton 6fa47125b5 freertos: Fix crash when waking task on CPU1 with scheduler disabled
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:?
2017-06-28 15:00:04 +08:00
Jeroen Domburg 33a9a37dd4 Make sure mmap always allocates an internal bit of memory for mmap housekeeping 2017-06-28 13:55:58 +08:00
Wangjialin 2fbc62f986 feature(psram): add 80Mhz mode for psram. Since we have flash rom code patch now, we can fix the compatibility issue between SPI APIs and psram.
1. add qio enable option in bootloader for GD25LQ32C flash.
2. add option for psram mode: 40m+40m, 80m+40m, 80m+80m.
3. fix bugs in spi_flash_rom_patch
2017-06-24 13:28:51 +08:00
Jeroen Domburg 983c3d7e1d Improve documentation: GPIO16/17 was swapped, psram pin 7 was missing 2017-06-05 13:16:42 +08:00
Jeroen Domburg d59955a1fd Add external RAM document 2017-06-02 18:11:53 +08:00
Jeroen Domburg 5e63563b98 Fix intlvl4 panic handler, dport interrupt 2017-05-26 18:53:10 +08:00
Jeroen Domburg 5a125b5cb4 Also add added BT rom functions to psram workaround ld file 2017-05-24 15:31:43 +08:00
Jeroen Domburg 221376ffdb Typo fix 2017-05-18 16:50:47 +08:00
Jeroen Domburg b52788e764 Add reserved DMA/internal region 2017-05-18 16:48:52 +08:00
Jeroen Domburg 74a535ff70 Release coprocessor registers when a task is deleted. 2017-05-18 15:40:54 +08:00
Jeroen Domburg 4a6e444300 Fix ld file for psram workaround 2017-05-17 12:01:59 +08:00
Jeroen Domburg 5c13d7385c Remove superfluous task_is_internal check, port dport interrupt to separate int handler 2017-05-16 15:36:18 +08:00
Jeroen Domburg 5c50419aef Kill dummy lock from newlib so the real lock functions get used 2017-05-16 14:12:08 +08:00
Jeroen Domburg f2b6e6941f New psram fix for newlib: also add workaround to memset/memcpy/strlen/... 2017-05-16 14:12:08 +08:00
Jeroen Domburg f38386023a I should not compile the workaround newlib stuff with a compiler which only knows about a partial workaround... 2017-05-16 14:12:07 +08:00
Jeroen Domburg 0faa881470 Add fundamental newlib routines (memcpy etc) to IRAM 2017-05-16 14:12:07 +08:00
Jeroen Domburg 68ef6723bb Fix lib picking, revert non-workaround libs to whatever is in master to hopefully make later merging easier. 2017-05-16 14:12:07 +08:00
Jeroen Domburg 3b07fcebb6 Fix rebase artifacts 2017-05-16 14:12:06 +08:00
Jeroen Domburg 363e595c60 Do not forget to add files 2017-05-16 14:12:06 +08:00
Jeroen Domburg 4918907257 Add psram workaround newlib versions, add some documentation 2017-05-16 14:12:04 +08:00
Jeroen Domburg afd10b982b Recompiled newlib to make memmove use the workaround 2017-05-16 14:11:01 +08:00
Jeroen Domburg 754f574aab Rebasing to latest master 2017-05-16 14:10:59 +08:00
Jeroen Domburg cb0dd77975 Always allocate stack in internal memory 2017-05-16 13:14:32 +08:00
Jeroen Domburg c46d7e60b0 Also add cache mode choice to menuconfig 2017-05-16 13:14:32 +08:00
Jeroen Domburg 4fd173c8c3 Add option for memory barriers everywhere 2017-05-16 13:14:32 +08:00
Jeroen Domburg 58e8763874 Move debug exception vector to vector_defaults.S 2017-05-16 13:14:32 +08:00
Jeroen Domburg 202a5db2d2 Rework high interrupt code to be able to link to external handlers; add psram test that swarms cpu with interrupts 2017-05-16 13:14:30 +08:00
Jeroen Domburg b63921a99c Add option to enable compiler psram workaround. Needs custom crosstool. 2017-05-16 13:13:01 +08:00
Jeroen Domburg d970307120 Change default mode to low/high for dualcore 2017-05-16 13:13:01 +08:00
Jeroen Domburg bbb1820501 Do not mark SPI ram as DMA-capable 2017-05-16 13:13:01 +08:00
Jeroen Domburg dff9385fc4 Kill debug messages in heap allocator, delete unused var. 2017-05-16 13:13:01 +08:00
Jeroen Domburg c09ba35d3b Fix int level 4 panics to give a correct backtrace. Add cache invalid access interrupt to panic handler reasons and wire it up to panic(). Fix issue where cache was re-enabled for pro cpu and pro cpu continuing execution while cache was still disabled on app cpu. 2017-05-16 13:13:01 +08:00
Jeroen Domburg c9a7d21068 Fix intlvl 4 stuff to give a correct backtrace; add cache invalid access to intlvl4 2017-05-16 13:13:01 +08:00
Jeroen Domburg e954277d7b Fix up tests for stack not in psram on flash, add small testcase 2017-05-16 13:12:59 +08:00
Jeroen Domburg 6e992cc6cc Get rid of superfluous printf 2017-05-16 13:11:59 +08:00
Jeroen Domburg 671787a966 After rebasing, it was found out that flushing the cache drops the writeback-pending psram cache lines on the ground. We now evict these by reading 64/128K of memory before flushing the cache. Also fixes a snafu in psram cache mode (inverted hi/lo and even/odd selectors) as well as an option to not let the heap allocator touch the psram. 2017-05-16 13:11:59 +08:00
Jeroen Domburg 96be5f3700 Get rid of _all_ uint16_t things that refer to stack size. Plus small fix to panic, not break, when coproc enable error. 2017-05-16 13:11:59 +08:00
Jeroen Domburg 0be8f6d308 Also use 32-bit stack lengths in prvTaskCheckFreeStackSpace and friends 2017-05-16 13:11:59 +08:00
Jeroen Domburg db8c93afb1 FreeRTOS: Make stack size in task create functions an uint32_t, so we can allocate more than 32K of stack if needed. 2017-05-16 13:11:59 +08:00
Wangjialin 8af42554ba remove unused codes in psram driver 2017-05-16 13:11:58 +08:00
Wangjialin 34d9cf4f00 update psram driver:
1. fix init error after system restart
2. use MACROs for GPIO definition and psram id.
3. format the code
2017-05-16 13:11:58 +08:00
Jeroen Domburg 39d9882be9 More MR comment fixes 2017-05-16 13:11:58 +08:00
Jeroen Domburg da1ef5da03 Maybe I should try to compile before commit/push... 2017-05-16 13:11:58 +08:00
Jeroen Domburg 84b728e7fd Some fixes to MR comments 2017-05-16 13:11:58 +08:00
Jeroen Domburg b3a526536c Fix warnings for test 2017-05-16 13:11:58 +08:00
Jeroen Domburg 43c0758b8d Remove superfluous example 2017-05-16 13:11:58 +08:00
Jeroen Domburg fe3082fa98 Do not declare test_spiram when option is disabled 2017-05-16 13:11:58 +08:00
Jeroen Domburg 0049b918b4 Fix psram silicon bug test; clean up Kconfig mess, clean out psram unused functions warnings 2017-05-16 13:11:56 +08:00
Jeroen Domburg c6d01c2bd2 Fix dualcore PSRAM. 2017-05-16 13:11:30 +08:00