summaryrefslogtreecommitdiffstatshomepage
Commit message (Collapse)AuthorAge
* cc3200: Allow to compile bootloader with threading enabled.Damien George2016-06-28
| | | | | Threading is not used in the bootloader but the config optios are still enabled so we must exclude including FreeRTOS.h.
* cc3200: Shrink the FreeRTOS heap and place TCB+stack in freed location.Damien George2016-06-28
| | | | | | | | | | | | | | | The 16k FreeRTOS heap originally had all TCBs and stacks dynamically allocated within it (plus semaphores and some other things). Now that xTaskCreateStatic is used instead of xTaskCreate, the TCBs and stacks are allocated statically and no longer use any of the FreeRTOS heap. Therefore, the FreeRTOS stack can be shrunk by the amount that has been made static. Furthermore, the TCBs and stack that are now static should be placed in the .rtos_heaps section of RAM because this RAM is treated specially by the bootloader (the bootloader executes from the first 16k of RAM and loads the firmware into the section starting after the 16k). After this patch the FreeRTOS heap (ucHeap) is 7200 bytes. The memory available for the MicroPython heap is 54936 bytes (including GC overhead).
* cc3200: Start the simplelink spawn task using the static task creator.Damien George2016-06-28
| | | | | | | | | In VStartSimpleLinkSpawnTask we change xTaskCreate to xTaskCreateStatic so that the task is created using statically allocated memory for the TCB and stack. This means that xTaskCreate function is no longer needed (the static version is now used exclusively).
* cc3200: Remove .boot section attribute from osi_TaskCreate function.Damien George2016-06-28
| | | | | | This function is no longer used. Having the .boot section attribute meant that it was included in the firmware regargless of use. Without this attribute the linker can remove the function.
* cc3200: In FreeRTOSConfig.h, comment on configSUPPORT_STATIC_ALLOCATION.Damien George2016-06-28
| | | | | This config variable is now needed regardless of whether threading is enabled or not.
* tests/thread: Allow some tests to run on ports with not much heap.Damien George2016-06-28
|
* tests/thread: Allow thread_sleep1 to run without floating point.Damien George2016-06-28
|
* cc3200: Enable the GIL.Damien George2016-06-28
|
* cc3200/mpthreadport: Move mem alloc outside the thread_mutex lock.Damien George2016-06-28
| | | | | Otherwise there could be a deadlock, with the GC's mutex and thread_mutex.
* cc3200/mpthreadport: Scan more root pointers from thread data.Damien George2016-06-28
|
* cc3200/gccollect: Use MP_STATE_THREAD(stack_top) to get top of stack.Damien George2016-06-28
|
* cc3200/mpthreadport: Properly initialise the main thread's data.Damien George2016-06-28
|
* cc3200/mpthreadport: Make mutex statically allocated.Damien George2016-06-28
| | | | Reduced the need for the FreeRTOS heap to allocate the mutex.
* cc3200: Use xTaskCreateStatic instead of osi_TaskCreate.Damien George2016-06-28
| | | | | | This allows to statically allocate the TCB (thread control block) and thread stack in the BSS segment, reducing the need for dynamic memory allocation.
* py/mpthread: Include mpstate.h when defining GIL macros.Damien George2016-06-28
|
* tests/thread: Make sure that thread tests don't rely on floating point.Damien George2016-06-28
|
* tests/thread: Make stack-size test run correctly and reliable on uPy.Damien George2016-06-28
|
* py/nlrsetjmp: Update to take into account new location of nlr_top.Damien George2016-06-28
| | | | It's now accessed via the MP_STATE_THREAD macro.
* py/nlrthumb: Convert NLR thumb funcs from asm to C with inline-asm.Damien George2016-06-28
| | | | | | | Now only the bits that really need to be written in assembler are written in it, otherwise C is used. This means that the assembler code no longer needs to know about the global state structure which makes it much easier to maintain.
* cc3200: Fix call to new exception to be _msg instead of _arg1.Damien George2016-06-28
|
* py/modthread: Allow to properly set the stack limit of a thread.Damien George2016-06-28
| | | | | We rely on the port setting and adjusting the stack size so there is enough room to recover from hitting the stack limit.
* cc3200: Add basic threading capabilities.Damien George2016-06-28
| | | | Can create a new thread and run it. Does not use the GIL at this point.
* cc3200: Define our own FreeRTOS heap so it can go in a special segment.Damien George2016-06-28
|
* cc3200: Update FreeRTOS to v9.0.0.Damien George2016-06-28
| | | | | | | | | | | | | | | | | | | | | | | This is a pristine copy (actually a subset of files) of upstream FreeRTOS v9.0.0. Modifications to the previous version of FreeRTOS (v8.1.2) included addition of __attribute__ ((section (".boot"))) to the following functions: pxPortInitialiseStack prvTaskExitError prvPortStartFirstTask xPortStartScheduler vPortSetupTimerInterrupt xTaskGenericCreate vTaskStartScheduler prvInitialiseTCBVariables prvInitialiseTaskLists prvAllocateTCBAndStack This attribute will need to be reinstated on a case-by-case basis because some of the above functions are now removed/changed.
* py/mpthread.h: Move GIL macros outside MICROPY_PY_THREAD block.Damien George2016-06-28
| | | | The GIL macros are needed even if threading is not enabled.
* unix/modtime: Release the GIL when sleeping.Damien George2016-06-28
|
* py/modthread: Make Lock objects work when GIL is enabled.Damien George2016-06-28
|
* py: Don't use gc or qstr mutex when the GIL is enabled.Damien George2016-06-28
| | | | | There is no need since the GIL already makes gc and qstr operations atomic.
* py: Implement a simple global interpreter lock.Damien George2016-06-28
| | | | | This makes the VM/runtime thread safe, at the cost of not being able to run code in parallel.
* py: Make interning of qstrs thread safe.Damien George2016-06-28
|
* tests/thread: Add test for concurrent mutating of user instance.Damien George2016-06-28
|
* tests/thread: Add test for concurrent interning of strings.Damien George2016-06-28
| | | | Qstr code accesses global state and needs to be made thread safe.
* tests/thread: Add tests that mutate shared objects.Damien George2016-06-28
| | | | Tests concurrent mutating access to: list, dict, set, bytearray.
* tests/thread: Rename thread_stress_XXX.py to stress_XXX.py.Damien George2016-06-28
|
* unix/mpthreadport: Suppress compiler warning about unused arguments.Damien George2016-06-28
|
* unix/gccollect: Provide declaration of exported function.Damien George2016-06-28
|
* unix/mpthreadport: Use SA_SIGINFO for GC signal handler.Damien George2016-06-28
| | | | | | SA_SIGINFO allows the signal handler to access more information about the signal, especially useful in a threaded environment. The extra information is not currently used but it may prove useful in the future.
* py/gc: Fix GC+thread bug where ptr gets lost because it's not computed.Damien George2016-06-28
| | | | | | | | | | | GC_EXIT() can cause a pending thread (waiting on the mutex) to be scheduled right away. This other thread may trigger a garbage collection. If the pointer to the newly-allocated block (allocated by the original thread) is not computed before the switch (so it's just left as a block number) then the block will be wrongly reclaimed. This patch makes sure the pointer is computed before allowing any thread switch to occur.
* unix: Implement garbage collection with threading.Damien George2016-06-28
| | | | | This patch allows any given thread to do a proper garbage collection and scan all the pointers of all active threads.
* py/modthread: Call mp_thread_start/mp_thread_finish around threads.Damien George2016-06-28
| | | | So the underlying thread implementation can do any necessary bookkeeping.
* py/modthread: Be more careful with root pointers when creating a thread.Damien George2016-06-28
|
* unix/file: If write syscall returns because of EINTR then try again.Damien George2016-06-28
| | | | As per PEP-475.
* py/gc: Fix 2 cases of concurrent access to ATB and FTB.Damien George2016-06-28
|
* py/modthread: Satisfy unused-args warning.Damien George2016-06-28
|
* tests/thread: Add tests for running GC within a thread, and heap stress.Damien George2016-06-28
|
* py/gc: Make memory manager and garbage collector thread safe.Damien George2016-06-28
| | | | | | By using a single, global mutex, all memory-related functions (alloc, free, realloc, collect, etc) are made thread safe. This means that only one thread can be in such a function at any one time.
* py/modthread: Add with-context capabilities to lock object.Damien George2016-06-28
|
* py/modthread: Implement lock object, for creating a mutex.Damien George2016-06-28
|
* py/modthread: Add exit() function.Damien George2016-06-28
| | | | Simply raises the SystemExit exception.
* py/modthread: Add stack_size() function.Damien George2016-06-28
|