Commit Graph

6187 Commits

Author SHA1 Message Date
Paul Sokolovsky
b09cd0e1ec extmod/modbtree: Fix unused argument warning. 2016-07-02 15:21:54 +03:00
Paul Sokolovsky
737bd9c314 py/mpconfig.h: Mention MICROPY_PY_BTREE config option.
However, as it requires linking with external libraries, it actually
should be ste on Makefile level.
2016-07-02 14:57:42 +03:00
Paul Sokolovsky
ae184cb9de py/builtinimport: Disable "imported as namespace package" warning.
Namespace packages are natural part of Python3, CPython3 doesn't have such
warning, it made sense only from point of view of Python2 legacy.
2016-07-02 14:45:49 +03:00
Paul Sokolovsky
c880f91ac0 extmod/modwebrepl: Add readinto() method. 2016-07-02 14:05:37 +03:00
Paul Sokolovsky
03b0279c6d extmod/modwebsocket: Add readinto() method. 2016-07-02 14:03:49 +03:00
Paul Sokolovsky
92a9078a6f tests/meminfo: Update for addition of "max free sz" output. 2016-07-01 00:39:26 +03:00
Paul Sokolovsky
749cbaca7f py/gc: Calculate (and report) maximum contiguous free block size.
Just as maximum allocated block size, it's reported in allocation units
(not bytes).
2016-07-01 00:09:55 +03:00
Radomir Dopieralski
35962eaab0 esp8266/modpybuart: allow setting baudrate and other params 2016-06-30 18:18:50 +02:00
Paul Sokolovsky
d1b7ba5dc1 esp8266/websocket_helper.py: Fix typo in debug output. 2016-06-30 13:34:58 +03:00
Paul Sokolovsky
6a6e0b7e05 py/gc: Be sure to count last allocated block at heap end in stats.
Previously, if there was chain of allocated blocks ending with the last
block of heap, it wasn't included in number of 1/2-block or max block
size stats.
2016-06-30 12:56:21 +03:00
Paul Sokolovsky
6907496016 esp8266/websocket_helper.py: Avoid extra string allocations. 2016-06-30 00:02:45 +03:00
dpslwk
f3636a7b46 stmhal: Enable SD card on L4 MCUs. 2016-06-29 14:29:01 +01:00
dpslwk
b03df60f32 stmhal: Correct DMA to allow SD card on L4 MCUs. 2016-06-29 14:28:49 +01:00
dpslwk
14b7c3e59c stmhal: Update HALCOMMITS due to change to hal 2016-06-29 14:28:49 +01:00
dpslwk
daa279a3a1 stmhal: Port of f4 hal commit 1d7fb82 to l4 hal 2016-06-29 14:27:55 +01:00
Damien George
56845b6aff esp8266/README: Describe how to build mpy-cross. 2016-06-29 14:25:12 +01:00
Damien George
db80c0ed46 esp8266: Enable frozen bytecode, with scripts in modules/ subdir.
To start with, the critical scripts _boot.py and flashbdev.py are frozen
to improve performance and reduce RAM consumption.

Saves about 1000 bytes of heap RAM for a bare boot with filesystem.
2016-06-29 13:59:19 +01:00
Damien George
b9e3fde21a qemu-arm: Disable gcc LTO option for nlrthumb.c.
If LTO is enabled for nlrthumb.c then gcc optimises away the nlr_push_tail
function when in fact it is needed.  So disable this option for this file.
2016-06-28 12:30:26 +01:00
Damien George
d862a7b811 cc3200: Remove obsolete singleton heart-beat object. 2016-06-28 11:28:53 +01:00
Damien George
842c2c74c0 cc3200: Allow to compile bootloader with threading enabled.
Threading is not used in the bootloader but the config optios are still
enabled so we must exclude including FreeRTOS.h.
2016-06-28 11:28:53 +01:00
Damien George
469c623bb8 cc3200: Shrink the FreeRTOS heap and place TCB+stack in freed location.
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).
2016-06-28 11:28:53 +01:00
Damien George
e098eac195 cc3200: Start the simplelink spawn task using the static task creator.
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).
2016-06-28 11:28:53 +01:00
Damien George
5b8e884573 cc3200: Remove .boot section attribute from osi_TaskCreate function.
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.
2016-06-28 11:28:53 +01:00
Damien George
1d5aa9d245 cc3200: In FreeRTOSConfig.h, comment on configSUPPORT_STATIC_ALLOCATION.
This config variable is now needed regardless of whether threading is
enabled or not.
2016-06-28 11:28:53 +01:00
Damien George
8b9ddf4031 tests/thread: Allow some tests to run on ports with not much heap. 2016-06-28 11:28:52 +01:00
Damien George
63d05228a3 tests/thread: Allow thread_sleep1 to run without floating point. 2016-06-28 11:28:52 +01:00
Damien George
53562213c8 cc3200: Enable the GIL. 2016-06-28 11:28:52 +01:00
Damien George
fa2ac93c3a cc3200/mpthreadport: Move mem alloc outside the thread_mutex lock.
Otherwise there could be a deadlock, with the GC's mutex and
thread_mutex.
2016-06-28 11:28:52 +01:00
Damien George
757146efe3 cc3200/mpthreadport: Scan more root pointers from thread data. 2016-06-28 11:28:52 +01:00
Damien George
17886828c8 cc3200/gccollect: Use MP_STATE_THREAD(stack_top) to get top of stack. 2016-06-28 11:28:52 +01:00
Damien George
3b0fbfe4e5 cc3200/mpthreadport: Properly initialise the main thread's data. 2016-06-28 11:28:52 +01:00
Damien George
27241293c4 cc3200/mpthreadport: Make mutex statically allocated.
Reduced the need for the FreeRTOS heap to allocate the mutex.
2016-06-28 11:28:52 +01:00
Damien George
0455755296 cc3200: Use xTaskCreateStatic instead of osi_TaskCreate.
This allows to statically allocate the TCB (thread control block) and
thread stack in the BSS segment, reducing the need for dynamic memory
allocation.
2016-06-28 11:28:52 +01:00
Damien George
77e37ff98b py/mpthread: Include mpstate.h when defining GIL macros. 2016-06-28 11:28:52 +01:00
Damien George
15e68277c1 tests/thread: Make sure that thread tests don't rely on floating point. 2016-06-28 11:28:52 +01:00
Damien George
5b7789d519 tests/thread: Make stack-size test run correctly and reliable on uPy. 2016-06-28 11:28:52 +01:00
Damien George
94238d4ae5 py/nlrsetjmp: Update to take into account new location of nlr_top.
It's now accessed via the MP_STATE_THREAD macro.
2016-06-28 11:28:52 +01:00
Damien George
1df4168c33 py/nlrthumb: Convert NLR thumb funcs from asm to C with inline-asm.
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.
2016-06-28 11:28:52 +01:00
Damien George
c9520c591b cc3200: Fix call to new exception to be _msg instead of _arg1. 2016-06-28 11:28:51 +01:00
Damien George
df95f52583 py/modthread: Allow to properly set the stack limit of a thread.
We rely on the port setting and adjusting the stack size so there is
enough room to recover from hitting the stack limit.
2016-06-28 11:28:51 +01:00
Damien George
eef4f13a33 cc3200: Add basic threading capabilities.
Can create a new thread and run it.  Does not use the GIL at this point.
2016-06-28 11:28:51 +01:00
Damien George
9b1c1262dc cc3200: Define our own FreeRTOS heap so it can go in a special segment. 2016-06-28 11:28:50 +01:00
Damien George
5c0fc73f33 cc3200: Update FreeRTOS to v9.0.0.
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.
2016-06-28 11:28:50 +01:00
Damien George
e90b6ce0b5 py/mpthread.h: Move GIL macros outside MICROPY_PY_THREAD block.
The GIL macros are needed even if threading is not enabled.
2016-06-28 11:28:50 +01:00
Damien George
94d2919b77 unix/modtime: Release the GIL when sleeping. 2016-06-28 11:28:50 +01:00
Damien George
c567afc5fa py/modthread: Make Lock objects work when GIL is enabled. 2016-06-28 11:28:50 +01:00
Damien George
a1c93a62b1 py: Don't use gc or qstr mutex when the GIL is enabled.
There is no need since the GIL already makes gc and qstr operations
atomic.
2016-06-28 11:28:50 +01:00
Damien George
4cec63a9db py: Implement a simple global interpreter lock.
This makes the VM/runtime thread safe, at the cost of not being able to
run code in parallel.
2016-06-28 11:28:50 +01:00
Damien George
1f54ad2aed py: Make interning of qstrs thread safe. 2016-06-28 11:28:50 +01:00
Damien George
b7274e91bc tests/thread: Add test for concurrent mutating of user instance. 2016-06-28 11:28:50 +01:00