aboutsummaryrefslogtreecommitdiff
path: root/stmhal/main.c
AgeCommit message (Collapse)Author
2015-02-13stmhal: Make pybstdio usable by other ports, and use it.Damien George
Now all ports can use pybstdio.c to provide sys.stdin/stdout/stderr, so long as they implement mp_hal_stdin_* and mp_hal_stdout_* functions.
2015-02-13stmhal: Properly define pyb.usb_mode() semantics.Damien George
2015-02-13stmhal: Add "CDC" option to pyb.usb_mode, for CDC device only.Damien George
2015-02-13stmhal: Add Python-configurable USB HID mode.Damien George
Different HID modes can be configured in Python. You can either use predefined mouse or keyboard, or write your own report descriptor.
2015-01-09stmhal: Reclaim 72 bytes of stack by factoring out flash init code.Damien George
2015-01-07stmhal: Collect all root pointers together in 1 place.Damien George
A GC in stmhal port now only scans true root pointers, not entire BSS. This reduces base GC time from 1700ms to 900ms.
2015-01-01stmhal: Prefix includes with py/; remove need for -I../py.Damien George
2014-10-25stmhal: Change fresh boot.py and main.py to use \r\n newlines.Damien George
This is so it's compatible with Windows.
2014-10-22Add pyb.hard_reset, and make sys.exit() or raise SystemExit do a soft reset.Dave Hylands
2014-10-21stmhal: Overhaul UART class to use read/write, and improve it.Damien George
UART object now uses a stream-like interface: read, readall, readline, readinto, readchar, write, writechar. Timeouts are configured when the UART object is initialised, using timeout and timeout_char keyword args. The object includes optional read buffering, using interrupts. You can set the buffer size dynamically using read_buf_len keyword arg. A size of 0 disables buffering.
2014-10-06stmhal: Remove long-obsolete pybwlan.[ch] files from old CC3k driver.Damien George
2014-09-30stmhal: Add network and usocket module.Damien George
As per issue #876, the network module is used to configure NICs (hardware modules) and configure routing. The usocket module is supposed to implement the normal Python socket module and selects the underlying NIC using routing logic. Right now the routing logic is brain dead: first-initialised, first-used. And the routing table is just a list of registered NICs. cc3k and wiznet5k work, but not at the same time due to C name clashes (to be fixed). Note that the usocket module has alias socket, so that one can import socket and it works as normal. But you can also override socket with your own module, using usocket at the backend.
2014-09-29stmhal: Add label to internal flash drive on creation.Damien George
2014-09-23stmhal: Initialise stack pointer correctly.Damien George
Stack is full descending and must be 8-byte aligned. It must start off pointing to just above the last byte of RAM. Previously, stack started pointed to last byte of RAM (eg 0x2001ffff) and so was not 8-byte aligned. This caused a bug in combination with alloca. This patch also updates some debug printing code. Addresses issue #872 (among many other undiscovered issues).
2014-09-15py: Move definition of mp_sys_exit to core.Damien George
sys.exit always raises SystemExit so doesn't need a special implementation for each port. If C exit() is really needed, use the standard os._exit function. Also initialise mp_sys_path and mp_sys_argv in teensy port.
2014-08-25Add save/restore_irqDave Hylands
Factored irq functions into a separate file.
2014-08-16stmhal: In safe mode, still mount SD card and present as MSD over USB.Damien George
It's still "safe" because no scripts are run. Remove the SD card if you want to access the internal flash filesystem. Addresses issue #616. Also: remove obsolete pyb.source_dir setting, and reset pyb.main and pyb.usb_mode settings on soft-reset.
2014-08-10doc: Document gc, sys, math, cmath.Damien George
2014-08-04stmhal: Clean up reset/soft-reset code; fix bug init'ing VCP exc.Damien George
Make a clearer distinction between init functions that must be done before any scripts can run (xxx_init0) and those that can be safely deferred (xxx_init). Fix bug initialising USB VCP exception. Addresses issue #788. Re-order some init function to improve reliability of reset/soft-reset.
2014-08-04Put call to qstr_init and mp_init_emergency_exc_buf in mp_init.Damien George
qstr_init is always called exactly before mp_init, so makes sense to just have mp_init call it. Similarly with mp_init_emergency_exception_buf. Doing this makes the ports simpler and less error prone (ie they can no longer forget to call these).
2014-07-31stmhal: Change 0:/ and 1:/ to /flash and /sd; add CWD support.Damien George
Some important changes to the way the file system is structured on the pyboard: 1. 0: and 1: drive names are now replaced with POSIX inspired directories, namely /flash and /sd. 2. Filesystem now supports the notion of a current working directory. Supports the standard Python way of manipulating it: os.chdir and os.getcwd. 3. On boot up, current directory is /flash if no SD inserted, else /sd if SD inserted. Then runs boot.py and main.py from the current dir. This is the same as the old behaviour, but is much more consistent and flexible (eg you can os.chdir in boot.py to change where main.py is run from). 4. sys.path (for import) is now set to '' (current dir), plus /flash and /flash/lib, and then /sd and /sd/lib if SD inserted. This, along with CWD, means that import now works properly. You can import a file from the current directory. 5. os.listdir is fixed to return just the basename, not the full path. See issue #537 for background and discussion.
2014-07-25Add support for storing args during an exception raised by an irq.Dave Hylands
The user code should call micropython.alloc_emergency_exception_buf(size) where size is the size of the buffer used to print the argument passed to the exception. With the test code from #732, and a call to micropython.alloc_emergenncy_exception_buf(100) the following error is now printed: ```python >>> import heartbeat_irq Uncaught exception in Timer(4) interrupt handler Traceback (most recent call last): File "0://heartbeat_irq.py", line 14, in heartbeat_cb NameError: name 'led' is not defined ```
2014-07-20stmhal: Fix REPL printing by cooking output sent to stdout_obj.Damien George
Recent changes to builtin print meant that print was printing to the mp_sys_stdout_obj, which was sending data raw to the USB CDC device. The data should be cooked so that \n turns into \r\n.
2014-07-02stmhal: Some reordering of code/functions.Damien George
2014-07-02Merge branch 'add-timer-deinit' of github.com:dhylands/micropython into ↵Damien George
dhylands-add-timer-deinit
2014-07-01stackctrl: Add "mp_" prefix.Paul Sokolovsky
2014-06-30Add timer_deinit and call it just before doing a soft-restartDave Hylands
This fixes #733.
2014-06-30Merge pull request #710 from iabdalkader/assertDamien George
Fix assert_func warning/error
2014-06-28stmhal: Include mpconfig.h before all other includes.Paul Sokolovsky
It defines types used by all other headers. Fixes #691.
2014-06-27py: Move stack_ctrl_init() to mp_init().Paul Sokolovsky
As stack checking is enabled by default, ports which don't call stack_ctrl_init() are broken now (report RuntimeError on startup). Save them trouble and just init stack control framework in interpreter init.
2014-06-27stmhal: Use stackctrl framework.Paul Sokolovsky
2014-06-21Add NORETURN to __fatal_errormux
2014-06-21Fix asser_func warning/errormux
* Add while(1) to assert_func to avoid func returns warning * Define a weak attr in mpconfig.h
2014-06-19Prefix ARRAY_SIZE with micropython prefix MP_Emmanuel Blot
2014-06-15stmhal: Update and improve LCD driver.Damien George
Still some method names to iron out, and funtionality to add, but this will do for the first, basic version.
2014-06-14Make __assert_func weakmux
2014-06-14Add __assert_func only if DEBUG=1mux
2014-06-14Add __assert_funcmux
* issue #692
2014-05-24Add SystemExit exception and use it in unix/ and stmhal/ ports.Damien George
Addresses issue #598.
2014-05-10stmhal: Implement draft version of sys.exit().Paul Sokolovsky
2014-05-03Add license header to (almost) all files.Damien George
Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-03stmhal: Wrap CC3000 driver in MICROPY_HW_ENABLE_CC3K.Damien George
This renames MICROPY_HW_HAS_WLAN to MICROPY_HW_ENABLE_CC3K (since it's a driver, not a board feature) and wraps all CC3000 code in this #if. It's disabled for all boards.
2014-04-30stmhal: Reinstate CC3000 driver from old stm/ port.Damien George
It's not enabled by default because it doesn't fully work. It can connect to an AP, get an IP address and do a host-lookup, but not yet do send or recv on a socket.
2014-04-26Add ARRAY_SIZE macro, and use it where possible.Damien George
2014-04-21stmhal: Make switch a class, to follow suit of all other modules.Damien George
Instead of pyb.switch() as a function, it's more consistent (with respect to all the other modules and peripherals) to have pyb.Switch() create a switch object. This then generalises to having multiple switches. Call the object to get its state. Use sw.callback to set the callback function for when the switch is pressed.
2014-04-21stmhal: Add Timer class: simple TIM control, incl callback on IRQ.Damien George
Simple but functional timer control. More sophistication will eventually be added, or for now just use direct register access :) Also added pyb.freq() function to get MCU clock frequencies.
2014-04-21stmhal: Rename USART to UART.Damien George
It's really a UART because there is no external clock line (and hence no synchronous ability, at least in the implementation of this module). USART should be reserved for a module that has "S"ynchronous capabilities. Also, UART is shorter and easier to type :)
2014-04-20stmhal: Only init RNG if it's used.Damien George
2014-04-20stmhal: Tidy up and improve consistency across modules.Damien George
2014-04-20stmhal: Add SPI class.Damien George
Also some updates to compile with latest changes to core py.