Commit Graph

945 Commits

Author SHA1 Message Date
Damien George 2613ffde43 py: Rename strtonum to mp_strtonum.
strtonum clashes with BSD function of same name, and our version is
different so warrants a unique name.  Addresses Issue #305.
2014-02-22 17:49:15 +00:00
Damien George 0379b55ab0 py: Fix casting and printing of small int. 2014-02-22 17:34:09 +00:00
Damien George b25ef4db3b Merge pull request #314 from pfalcon/parse-node-refactor
parse: Refactor parse node encoding to support full range of small ints.
2014-02-22 17:07:01 +00:00
Paul Sokolovsky 56e5ef203b parse: Refactor parse node encoding to support full range of small ints.
Based on suggestion by @dpgeorge at
https://github.com/micropython/micropython/pull/313
2014-02-22 16:39:45 +02:00
Paul Sokolovsky bbf0e2fe12 parse: Note that fact that parser's small ints are different than VM small int.
Specifically, VM's small ints are 31 bit, while parser's only 28. There's already
MP_OBJ_FITS_SMALL_INT(), so, for clarity, rename MP_FIT_SMALL_INT() to
MP_PARSE_FITS_SMALL_INT().
2014-02-21 03:27:09 +02:00
Paul Sokolovsky 1d30b11685 showbc: Update for recent int varlen storage refactor.
TODO: De-duplicate DECODE_UINT, etc. definitions.
2014-02-21 03:26:56 +02:00
Paul Sokolovsky feacaa12ac __import__: Catch relative import attempts and throw NotImplementedError. 2014-02-21 01:15:20 +02:00
Paul Sokolovsky a8d31b28bc emitbc: Correct buffer sizes for varlen int encoding.
Assuming we have truncating (floor) division, way to do ceiling division
by N is to use formula (x + (N-1)) / N. Specifically, 63 bits, if stored
7 bits per byte, require exactly 9 bytes. 64 bits overflow that and require
10 bytes.
2014-02-20 13:25:05 +02:00
Paul Sokolovsky a1aba36feb compile: Add comments ergarding non-implemented relative imports. 2014-02-20 13:22:28 +02:00
Damien George 4d79d5dd7c py: Fix type of integer in decoding int. 2014-02-20 00:00:04 +00:00
Damien George b74501c98f Merge pull request #312 from pfalcon/int-varlen
Support varlen encoding for arbitrary int and uint numbers
2014-02-19 23:56:23 +00:00
Damien George 2e87c62cf6 stm: Update PYBOARD4 pin mapping. 2014-02-19 23:38:42 +00:00
Damien George 948a58d56e Merge pull request #310 from dhylands/pin_map
Add pin mapping code.
2014-02-19 23:19:18 +00:00
Damien George 1b182a30d0 Merge branch 'master' of github.com:micropython/micropython 2014-02-19 23:15:40 +00:00
Damien George 302646625b stm: Add RTC start-up info, and uPy bindings. 2014-02-19 23:15:09 +00:00
Paul Sokolovsky fb7f94392d import: Implement "from pkg.mod import sym" syntax properly.
http://docs.python.org/3.3/library/functions.html#__import__ :
"When the name variable is of the form package.module, normally, the
top-level package (the name up till the first dot) is returned, not
the module named by name. However, when a non-empty fromlist argument
is given, the module named by name is returned."
2014-02-20 00:37:12 +02:00
Paul Sokolovsky 047cd40313 Bytecode int varlen encoding: support arbitrary values for signed ints too. 2014-02-19 15:53:41 +02:00
Paul Sokolovsky 0f96ec8268 Bytecode uint varlen encoding: support arbitrary values. 2014-02-19 15:52:57 +02:00
Dave Hylands 51dabac096 Add pin mapping code.
This commit also introduces board directories and moves board
specific config into the appropriate board directory.

boards/stm32f4xx-af.csv was extracted from the STM32F4xx datasheet
and hand-tweaked.

make-pins.py takes boards/stm32f4xx-af.csv, boards/stm32f4xx-prefix.c,
and boards/BOARD-NAME/pins.csv as input and generates the file
build/pins_BOARD_NAME.c

The generated pin file for PYBOARD4 looks like this:
https://gist.github.com/dhylands/9063231

The generated pins file includes all of the supported alternate
functions, and includes upsupported alternate functions as comments.

See the commnet block at the top of stm/pin_map.c for details on
how to use the pin mapper.

I also went ahead and modified stm/gpio.c to use the pin mapper.
2014-02-17 21:20:38 -08:00
Damien George 46239413d0 stm: Implement mp_import_stat.
To follow up pull request #309.
2014-02-17 22:44:20 +00:00
Paul Sokolovsky 4d0588df56 objint_longlong: Don't assert on invalid syntax, raise SyntaxError instead. 2014-02-18 00:22:19 +02:00
Damien George 517e1706bd Merge pull request #309 from pfalcon/stm-sys-path
stm: Initialize sys.path with ["0:/", "0:/src", "0:/lib"].
2014-02-17 22:21:25 +00:00
Damien George ff77dc567c Merge pull request #307 from iabdalkader/master
Fix usart_obj_tx_char
2014-02-17 22:17:56 +00:00
Paul Sokolovsky 4aee119f94 stm: Initialize sys.path with ["0:/", "0:/src", "0:/lib"].
This is compatible with what search path was before sys.path refactor,
with addition of module library path ("0:/lib").
2014-02-18 00:06:37 +02:00
mux d0ffda91cc Fix usart_obj_tx_char 2014-02-17 21:49:07 +02:00
Damien George f34947703a Merge pull request #303 from dhylands/fix-netduino-disc
Fix build for netduino and stm32f4disc
2014-02-17 09:48:53 +00:00
Damien George 70c56acafb Merge pull request #302 from pfalcon/readme-update
Update README to current state of affairs.
2014-02-17 09:47:27 +00:00
Dave Hylands 90928f1194 Fix build for netduino and stm32f4disc 2014-02-16 23:14:49 -08:00
Damien George 402dc31aa7 stm: Factor out GPIO code to its own file. Add functions to set GPIO mode.
GPIO functions are crude, and need to be replaced with better ones!
2014-02-16 23:44:23 +00:00
Paul Sokolovsky c839584222 Update README to current state of affairs.
1. Invite x86 (32-bit) users.
2. Update interpreter name.
3. Update dependency install instructions.
2014-02-17 01:26:39 +02:00
Damien George 2abbae3419 stm: Rename mma -> accel. 2014-02-16 21:41:57 +00:00
Damien George 754a8dd827 stm: Put REPL functions in own file; add raw REPL mode.
Raw REPL mode is activated by CTRL-A, and allows you to more easily
communicate with the pyboard over the serial channel.  In particular,
automated communication using, eg, pyserial on the PC side.
2014-02-16 21:36:03 +00:00
Damien George e4758ad2e2 Merge pull request #301 from pfalcon/full-kwargs
Support passing positional args as keywords to bytecode functions.
2014-02-16 21:14:50 +00:00
Paul Sokolovsky ac2e28c654 Support passing positional args as keywords to bytecode functions.
For this, record argument names along with each bytecode function. The code
still includes extensive debug logging support so far.
2014-02-16 18:36:33 +02:00
Paul Sokolovsky 44739e280e Make DEBUG_printf() a proper function, implementation is port-dependent.
In particular, unix outputs to stderr, to allow to run testsuite against
micropython built with debug output (by redirecting stderr to /dev/null).
2014-02-16 18:20:49 +02:00
Paul Sokolovsky 1b694c082e Rename fun-kwargs.py -> fun-kwvarargs.py to free up slot for simple kw test. 2014-02-16 15:55:06 +02:00
Damien George 8bb11171da stm: Only define __packed if not already defined.
Addresses issue #299.
2014-02-16 11:24:44 +00:00
Paul Sokolovsky 5fd7bc3264 Propagate scope flags refactor to emitcpy.c. 2014-02-16 03:02:47 +02:00
Paul Sokolovsky 91ba7a54c5 builtinimport: Get the basic (and only basic) package imports work. 2014-02-16 02:55:46 +02:00
Paul Sokolovsky d3783570a4 builtinimport.c: Recognize "namespace package" and error out as unsupported.
See http://www.python.org/dev/peps/pep-0420/#specification for spec. See
https://github.com/micropython/micropython/issues/298 for the discussion
of the implemented behavior.
2014-02-16 02:55:46 +02:00
Damien George e5d371b545 py: Pass keyword arguments to byte code. 2014-02-16 00:17:42 +00:00
Damien George 2e482cdb7b py: Implement *vargs support.
Addresses issue #295.
2014-02-16 00:01:29 +00:00
Damien George 96056a6272 py: Revent some long int configuration. 2014-02-15 23:02:00 +00:00
Damien George 91f2dbf64c Merge branch 'master' of github.com:micropython/micropython 2014-02-15 22:56:25 +00:00
Damien George c8f78bc280 py: VM never throws an exception, instead returns a status and value.
Addresses issue #290, and hopefully sets up things to allow generators
throwing exceptions, etc.
2014-02-15 22:55:00 +00:00
Paul Sokolovsky ff4678c5b4 objexcept: Fix thinko with args to mp_obj_new_list().
First arg is not alloc size, but real size, so if used as
mp_obj_new_list(3, NULL), need to store items, not append.
2014-02-16 00:42:56 +02:00
Damien George 36109d246f Small change to configuration of long int. 2014-02-15 22:16:33 +00:00
Damien George 22a0865d54 py: Improve exception bases, reduces ROM usage.
Thanks to @pfalcon for the tip!
2014-02-15 21:05:25 +00:00
Damien George 8725f8f7de py: Pass all scope flags through to runtime. 2014-02-15 19:33:11 +00:00
Damien George c5966128c7 Implement proper exception type hierarchy.
Each built-in exception is now a type, with base type BaseException.
C exceptions are created by passing a pointer to the exception type to
make an instance of.  When raising an exception from the VM, an
instance is created automatically if an exception type is raised (as
opposed to an exception instance).

Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper.

Handling of parse error changed to match new exceptions.

mp_const_type renamed to mp_type_type for consistency.
2014-02-15 16:10:44 +00:00