Commit Graph

350 Commits

Author SHA1 Message Date
Damien George e70b5dbe58 stmhal: Some reordering of code/functions. 2014-07-02 14:09:44 +01:00
Damien George 92a47b4dae Merge branch 'add-timer-deinit' of github.com:dhylands/micropython into dhylands-add-timer-deinit 2014-07-02 14:06:28 +01:00
Damien George 9cd96cf25d Merge pull request #709 from windelbouwman/master
Added hexfile target
2014-07-02 13:53:28 +01:00
Damien George 7a37f647a5 Merge branch 'teensy-new' of github.com:dhylands/micropython into dhylands-teensy-new
Conflicts:
	stmhal/pin_named_pins.c
	stmhal/readline.c

Renamed HAL_H to MICROPY_HAL_H.  Made stmhal/mphal.h which intends to
define the generic Micro Python HAL, which in stmhal sits above the ST
HAL.
2014-07-02 13:42:37 +01:00
Damien George aa47f3968b Merge pull request #734 from iabdalkader/copysign
Add copysignf
2014-07-01 14:03:55 +01:00
Paul Sokolovsky caa7334141 stackctrl: Add "mp_" prefix. 2014-07-01 02:14:08 +03:00
Dave Hylands 0d81c133b3 Add timer_deinit and call it just before doing a soft-restart
This fixes #733.
2014-06-30 08:07:38 -07:00
mux 5d44e6a92c Add copysignf
* Fix #692
2014-06-30 16:31:06 +02:00
Damien George 4039a26679 Merge pull request #710 from iabdalkader/assert
Fix assert_func warning/error
2014-06-30 09:09:24 +01:00
Paul Sokolovsky 5813efd634 stmhal: pyb.adc: Clarify that buffer with elements of any size can be used.
Based on forum post: http://forum.micropython.org/viewtopic.php?f=6&t=193
2014-06-29 21:34:58 +03:00
Paul Sokolovsky 8139494e54 stmhal: Include mpconfig.h before all other includes.
It defines types used by all other headers.

Fixes #691.
2014-06-28 23:32:03 +03:00
Damien George 635b60e299 unix, stmhal: Add option for STR_UNICODE to mpconfigport.h.
Unicode is disabled by default for now, since FileIO.read(n) is
currently not implemented for text-mode files, and this is an
often function.
2014-06-28 10:29:52 +01:00
Paul Sokolovsky 8a96ebea75 py: Move stack_ctrl_init() to mp_init().
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-27 21:02:04 +03:00
mux a75e382a9b Change MCU name config micro 2014-06-27 00:35:53 +02:00
Paul Sokolovsky 3659af97c5 Merge pull request #703 from iabdalkader/micro_names
Add MICROPY_HW_MICRO_NAME to boards config
2014-06-27 01:19:17 +03:00
Paul Sokolovsky 7a8ab5a730 stmhal: Use stackctrl framework. 2014-06-27 00:03:55 +03:00
Dave Hylands f170735b73 Use mp_const_none to initialize mapper and map_dict 2014-06-25 16:01:19 -07:00
mux 89b38d96c9 Add NORETURN to __fatal_error 2014-06-21 18:43:44 +02:00
mux 5c8db48541 Fix asser_func warning/error
* Add while(1) to assert_func to avoid func returns warning
* Define a weak attr in mpconfig.h
2014-06-21 17:24:55 +02:00
Paul Sokolovsky 09e3f8f0d1 Merge pull request #707 from eblot/master-v1.1.1-build-fixes
Fix missing declaration of assert()
Replace ARRAY_SIZE with MP_ARRAY_SIZE
2014-06-20 17:29:58 +03:00
Windel Bouwman b6af4c8104 Added hexfile target 2014-06-20 16:14:55 +02:00
Emmanuel Blot f6932d6506 Prefix ARRAY_SIZE with micropython prefix MP_ 2014-06-19 18:54:34 +02:00
mux fe81eea967 Add MICROPY_HW_MICRO_NAME to boards config 2014-06-19 14:40:57 +02:00
Sven Wegener c3cabf4e33 bare-arm, stmhal, teensy: Duplicate -nostdlib to CFLAGS
As we are building with -nostdlib gcc features like the stack protector
will fail linking, because the failure handlers are in gcc's internal
libs. Such features are implicitly disabled during compilation when
-nostdlib is used in CFLAGS too.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-06-18 13:34:07 +02:00
Sven Wegener afc67c6dc5 bare-arm, stmhal: Fix --nostdlib to -nostdlib
-nostdlib is the correct option, gcc recognizes the double dash version
when in link-only mode, but not when compiling.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-06-18 13:33:47 +02:00
Damien George 720f55cc4b Merge pull request #698 from dhylands/adc-fix
Fix problem with ADC reads and multiple channels
2014-06-17 20:52:47 +01:00
Damien George bcb3ab451b stmhal: Toggle LED using ODR ^= pin_mask. 2014-06-17 19:57:17 +01:00
Dave Hylands 535b88133c Fix problem with ADC reads and multiple channels 2014-06-16 09:41:58 -07:00
Dave Hylands 4f1b7fec9f Updated teensy to build.
Refactored some stmhal files which are shared with teensy.
2014-06-15 22:48:05 -07:00
Damien George 2547928148 stmhal: Add Python function to set UART for REPL.
This adds a hook to get/set pyb_uart_global_debug from Python, using
pyb.repl_uart().  You can set it to an arbitrary UART object, and then
the REPL (in and out) is repeated on this UART object (as well as on USB
CDC).

Ultimately, this will be replaced with a proper Pythonic interface to
set sys.stdin and sys.stdout.
2014-06-15 09:47:27 +01:00
Damien George c0711cbefa stmhal: Fix type signatures on functions that take variable args. 2014-06-15 09:32:42 +01:00
Damien George e79c6696c5 stmhal: Fix file print methods to use print instead of printf.
Also make stdout_print_strn static (ultimately this function needs to be
merged with stdout_tx_strn).
2014-06-15 09:10:07 +01:00
Damien George 34ab8dd6dd stmhal: Update and improve LCD driver.
Still some method names to iron out, and funtionality to add, but this
will do for the first, basic version.
2014-06-15 00:41:47 +01:00
mux 5f6f47a688 Make __assert_func weak 2014-06-14 17:02:50 +02:00
mux 00db5c81e1 Add __assert_func only if DEBUG=1 2014-06-14 15:53:11 +02:00
mux 34e7b67d3c Add __assert_func
* issue #692
2014-06-14 14:41:11 +02:00
Damien George 820896746c stmhal, file: Seek to end of file if opened in 'a' mode. 2014-06-11 16:01:52 +01:00
Damien George b7572ad11b stmhal, file: Implement a,x,+ open modes, seek and tell.
Also now returns correct POSIX errno when an IO operation fails.

Addresses issues #516 and #676.
2014-06-11 15:41:14 +01:00
Damien George 57b4dfa9c9 stmhal: Fix pyb.bootloader so it works for gcc-4.9.0.
See PR #618.
2014-06-08 14:01:43 +01:00
Damien George 4480cb3711 Provide definition of alloca() in mpconfigport.h. 2014-06-08 13:25:33 +01:00
bvernoux 82560fce75 Merge branch 'master' of https://github.com/micropython/micropython 2014-06-03 19:26:34 +02:00
bvernoux c3c353d7f1 Cleanup/removed specific stuff specific to HydraBus (except board). 2014-06-03 18:59:24 +02:00
Dave Hylands 4e0573e5cf Add missing commas to stm32f4xx-af.csv 2014-06-02 23:11:14 -07:00
bvernoux 569aa90137 micropython port for HydraBus 2014-06-02 21:43:02 +02:00
Damien George f1dbd78b30 stmhal: Document pyb.Accel() constructor, that it takes time to start. 2014-06-01 17:57:06 +01:00
Damien George fb510b3bf9 Rename bultins config variables to MICROPY_PY_BUILTINS_*.
This renames:
MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET
MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY
MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE
MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT

See issue #35 for discussion.
2014-06-01 13:32:54 +01:00
Dave Hylands b5fb9b22e2 Add a comma to make the .csv look proper in github 2014-05-30 22:18:52 -07:00
Damien George 2617eebf2f Change const byte* to const char* where sensible.
This removes need for some casts (at least, more than it adds need
for new casts!).
2014-05-25 22:27:57 +01:00
Damien George 7a4ddd2428 Add SystemExit exception and use it in unix/ and stmhal/ ports.
Addresses issue #598.
2014-05-24 23:32:19 +01:00
Damien George ee3fd46f13 Rename configuration variables controling Python features.
Now of the form MICROPY_PY_*.  See issue #35.
2014-05-24 23:03:12 +01:00
Damien George 58ebde4664 Tidy up some configuration options.
MP_ALLOC_* -> MICROPY_ALLOC_*
MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX
MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL
MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX
MICROPY_EXTRA_* -> MICROPY_PORT_*

See issue #35.
2014-05-21 20:32:59 +01:00
Damien George 6ac5dced24 py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.
See issue #608 for justification.
2014-05-21 19:42:43 +01:00
Damien George 6d197740cf stmhal: Stop USB before entering DFU by software. 2014-05-21 19:25:34 +01:00
Paul Sokolovsky 9e29666bf9 py: Implement proper separation between io.FileIO and io.TextIOWrapper.
io.FileIO is binary I/O, ans actually optional. Default file type is
io.TextIOWrapper, which provides str results. CPython3 explicitly describes
io.TextIOWrapper as buffered I/O, but we don't have buffering support yet
anyway.
2014-05-19 21:56:07 +03:00
Damien George eee31288dd stmhal: Fix DAC documentation: need to convert float to int for buf. 2014-05-19 19:08:12 +01:00
Damien George 2de4d59171 stmhal: Fix write_timed function for DAC(2).
Addresses issue #617.
2014-05-19 18:58:53 +01:00
Damien George f905ebb173 stmhal: Make pyb.bootloader take no arguments. 2014-05-19 18:26:51 +01:00
Sven Wegener 9bf4f7e3d3 stmhal: Remap system flash and adjust addresses
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-05-18 13:15:02 +02:00
Sven Wegener 7ae8e4b679 stmhal: Activate bootloader with pyb.bootloader()
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-05-18 12:51:21 +02:00
Damien George 89755ae67f py: Rename MICROPY_SYS_EXIT to MICROPY_MOD_SYS_EXIT.
For consistency with MICROPY_MOD_SYS_STDFILES, etc.
2014-05-11 17:35:43 +01:00
Damien George f92a0d4d16 stmhal: Enable frozenset. Takes 292 text bytes in ROM. 2014-05-11 17:27:31 +01:00
Damien George a7a1a38df4 stmhal: Update CC3000 driver to newer version.
Still not working properly.
2014-05-11 12:09:13 +01:00
Damien George 50073ed5d6 stmhal/cc3k: Remove spaces and tabs at end of lines. 2014-05-10 21:28:40 +01:00
Damien George 3793830ed9 tools: Move gendoc.py to tools, and make it a little more generic. 2014-05-10 19:12:47 +01:00
Damien George 09bbe7215a stmhal: Fix USB CDC not flushing packets when an exact multiple of 64.
Need to send a zero-sized packet after sending an exact multiple of 64
bytes (not just after sending 64 bytes exactly).

Addresses issue #494, part 2.
2014-05-10 18:56:16 +01:00
Damien George b0edec61ac stmhal: Improve handling of out-of-memory in REPL.
Addresses issue #558, but it's likely that other out-of-memory errors
could crash the pyboard.  Reason is that qstrs use m_new and can raise
an exception within the parser.
2014-05-10 17:48:46 +01:00
Paul Sokolovsky deaeaac469 modsys: Enable sys.exit() per port after all. 2014-05-10 17:26:47 +03:00
Paul Sokolovsky 0f14fdea0c stmhal: Implement draft version of sys.exit(). 2014-05-10 16:56:21 +03:00
Damien George 04b7cc4df0 stmhal: Fix setting of RTC: was BCD now BIN encoded.
Addresses issue #592.
2014-05-10 11:56:58 +01:00
Damien George 8c1c7488b2 Add gc.enable, gc.disable; remove pyb.gc. 2014-05-08 23:04:49 +01:00
Damien George d6cbbc51ab stmhal: Add time.time() and time.localtime().
time.time: returns seconds since 1/1/2000, as an integer.

time.localtime: Returns 8-tuple: (year, month, date, hour, minute,
    second, weekday, yearday).
2014-05-08 22:25:49 +01:00
Dave Hylands 117c46d9eb Add input command for unix 2014-05-07 07:19:51 -07:00
Damien George 491cbd6a7c py: Add keyword arg support to enumerate constructor.
Need to have a policy as to how far we go adding keyword support to
built ins.  It's nice to have, and gets better CPython compatibility,
but hurts the micro nature of uPy.

Addresses issue #577.
2014-05-06 16:38:54 +00:00
Paul Sokolovsky 33b3a6905d stmhal: pyb: Use gc() function as defined by standard module "gc".
TODO: Get rid of this compatibility define and rely on standard module.
2014-05-06 02:28:49 +03:00
Dave Hylands 1145a0706c Change references (in comments) of pyb.GPIO to be pyb.Pin
The documentation at http://micropython.org/doc/module/pyb/ExtInt should also be
updated.
2014-05-05 10:58:38 -07:00
Damien George 5fc400ccdb stmhal: Document physical pins for SPI, I2C, UART busses. 2014-05-04 14:28:11 +01:00
Damien George 04b9147e15 Add license header to (almost) all files.
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-03 23:27:38 +01:00
Damien George d5f5b2f766 py, stream: Implement readlines for a stream. 2014-05-03 22:01:32 +01:00
Craig Barnes c9f9e547d6 Add device ID to deploy make target for stmhal. 2014-05-03 19:51:47 +01:00
Damien George 6ec835dfef Don't print git hash as well as git tag in banner. 2014-05-03 19:08:02 +01:00
Damien George 977a0ce287 py: Print tag/version/git describe in uPy banner. 2014-05-03 19:02:14 +01:00
Damien George b4bb3fdb9c Merge pull request #555 from lurch/patch-1
RTC doc fix
2014-05-03 18:44:02 +01:00
Damien George 93e51b594a stmhal: Enable cmath module. 2014-05-03 18:40:50 +01:00
Andrew Scheller 86a9a88632 Fix incorrect fix ;) 2014-05-03 18:28:11 +01:00
Damien George bb8ba7fc90 stmhal: Add .gitignore to ignore the new build dir names. 2014-05-03 18:26:03 +01:00
Andrew Scheller e9ff5570c3 Updated doc fix 2014-05-03 17:50:46 +01:00
Damien George aad1204b8e stmhal: Change names: flash to firmware, flashboard to deploy.
Since firmware lives in a build directory which already specifies the
board name, no real reason to also have the firmware have the board
name.
2014-05-03 17:46:45 +01:00
Damien George 51315614e1 stmhal: Default build directory now includes board name.
BUILD is build-$(BOARD) by default.
2014-05-03 17:39:07 +01:00
Andrew Scheller b569d690f5 RTC doc fix 2014-05-03 17:34:19 +01:00
Damien George ae8feac598 stmhal: Wrap CC3000 driver in MICROPY_HW_ENABLE_CC3K.
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-05-03 17:32:55 +01:00
Damien George baa2afbb58 stmhal: Fix typos in class documentation. 2014-05-03 16:42:27 +01:00
Damien George bff1ff28ee stmhal: Fix bug where negative delay/udelay lead to huge delays.
A negative ms/us is now treated as a delay of 0 ms/us.  This patch also
improves the calibration of udelay.
2014-05-03 14:11:56 +01:00
Damien George 5874c1c92b stmhal: Remove #include <stdint.h> from mpconfigport.h.
Make include dependencies neater, and adheres to the coding convention
that headers should not include headers.
2014-05-03 13:24:21 +01:00
Damien George ffaf8be1c6 stmhal: Add example use to RTC doc; add rtc.c to gendoc.py. 2014-05-03 12:02:21 +00:00
Damien George 451f78d156 stmhal: Add documentation for RTC class. 2014-05-03 12:40:53 +01:00
Damien George 8f472ad577 Merge pull request #548 from dhylands/fix-pin-defn
Fix PB0 ADC typo.
2014-05-03 00:16:48 +01:00
Craig Barnes a0ddae86e5 Add device ID to autoflash script. 2014-05-02 23:03:23 +01:00
Dave Hylands 5788485cca Fix PB0 ADC typo.
This also adds a bunch of slashes separating pin that have multiple functions.
2014-05-02 14:01:23 -07:00
Damien George 003977a70b Merge branch 'master' of github.com:micropython/micropython 2014-05-02 16:58:32 +01:00
Damien George 3eb8163b16 stmhal: Add documentation for DAC and Timer classes. 2014-05-02 16:58:15 +01:00