Commit Graph

3056 Commits

Author SHA1 Message Date
Damien George 1e49b151a7 Merge branch 'master' of github.com:micropython/micropython 2014-10-09 16:54:14 +01:00
Damien George f0f964807e Merge branch 'dhylands-lexer-crash' 2014-10-09 16:54:03 +01:00
Damien George 9bf5f2857d py: Add further checks for failed malloc in lexer init functions. 2014-10-09 16:53:37 +01:00
Damien George a8202762f0 Merge branch 'lexer-crash' of https://github.com/dhylands/micropython into dhylands-lexer-crash 2014-10-09 16:48:55 +01:00
Damien George 40e4c777a1 Merge pull request #897 from tomvonclef/master
Updating README.md. The Unix build requires pkg-config for FFI.
2014-10-09 16:47:06 +01:00
Damien George 7989b07637 Merge branch 'dhylands-memory-error' 2014-10-09 16:45:15 +01:00
Damien George 4091445612 py: Add #if guard around gc-specific code. 2014-10-09 16:44:43 +01:00
Dave Hylands e20cbbec73 Make lexer fail gracefully when memory can't be allocated. 2014-10-08 23:17:35 -07:00
Tom von Clef 2090a98e80 Updating README.md to include the fact that the Unix build requires pkg-config to build the FFI module. 2014-10-08 17:26:03 -04:00
Dave Hylands 3556e45711 Allow real memory errors (from locked gc) to be reported with traceback. 2014-10-07 08:07:49 -07:00
Paul Sokolovsky 67f25dfe6f travis: Install realpath, required for teensy build. 2014-10-06 23:49:17 +03:00
Paul Sokolovsky 5d328cbeb9 windows: mingw32 gcc doesn't define endianness macros, so just assume little.
Specifically, at least Ubuntu's i586-mingw32msvc-gcc doesn't supply
__LITTLE_ENDIAN__ and friends. And as it's safe enough to assume that
Windows is only little-endian, then it's defined unconditionally,
instead of duplicating detection logic in py/mpconfig.h (or adding
windows-specific defines to it).
2014-10-06 23:18:59 +03:00
Paul Sokolovsky 5dc8f9b28a tests: Skip ffi_float.py if module ffi is not available. 2014-10-06 22:37:40 +03:00
Paul Sokolovsky 9aeec0e3a3 tests: Add missing "import sys". 2014-10-06 22:30:46 +03:00
Damien George f53c343363 tests: Force skip of LE test on non-LE arch; improve run-tests-exp.sh. 2014-10-06 17:35:46 +00:00
Damien George 9c6f7378f7 tests: Make run-tests-exp.sh skip tests that fail due to invalid decorator.
Should address issue #856.
2014-10-06 17:06:49 +00:00
Damien George f32498fe04 py: Extra autodetect for little endianness using __LITTLE_ENDIAN__. 2014-10-06 16:09:31 +00:00
Damien George fec70ad369 stmhal: Remove long-obsolete pybwlan.[ch] files from old CC3k driver. 2014-10-06 15:40:25 +00:00
Damien George 9336ee320a py: Make mp_binary_set_val work on big endian machine. 2014-10-06 15:05:35 +00:00
Damien George fcdb239815 py: Make int.to_bytes work on big endian machine.
Partly addresses issue #856.
2014-10-06 13:45:34 +00:00
Damien George a9bcd51dc7 py: Try to autodetect machine endianness when not defined by port. 2014-10-06 13:44:59 +00:00
Damien George 5a04e2cca8 tests: Add check for micropython.native and then skip relevant tests.
If micropython.native decorator doesn't compile, then we skill all
native/viper tests.

This patch also re-enables the ujson_loads test on NT.

Addresses issue #861, and partially addresses issue #856.
2014-10-05 22:27:12 +01:00
Damien George 854c8c0153 unix: Detect and print compile error. 2014-10-05 22:25:36 +01:00
Damien George d03c681608 stmhal: Use mp_uint_t where appropriate.
Found these by compiling stmhal with mp_uint_t of type uint32_t instead
of unsigned int.  This actually makes a difference to the code, but just
a curiosity.
2014-10-05 21:51:54 +01:00
Damien George c4d0868df1 py: Implement proper context save/restore for eval/exec; factor code.
This has benefits all round: code factoring for parse/compile/execute,
proper context save/restore for exec, allow to sepcify globals/locals
for eval, and reduced ROM usage by >100 bytes on stmhal and unix.

Also, the call to mp_parse_compile_execute is tail call optimised for
the import code, so it doesn't increase stack memory usage.
2014-10-05 20:13:34 +01:00
Damien George a91ac2011f py: Make compiler return a proper exception on SyntaxError. 2014-10-05 19:01:34 +01:00
Damien George 6dba992182 stmhal: Add config option to disable/enable CAN driver. 2014-10-05 18:05:26 +01:00
Damien George ba0383a8c7 stmhal, timer: Fix timer.chanel so mode can be a keyword. 2014-10-05 17:52:45 +01:00
Damien George 55f68b3ce8 stmhal, timer: Improve accuracy of freq computation. 2014-10-05 17:52:45 +01:00
Damien George 97ef94df83 stmhal, timer: Set freq from float; get timer source freq.
Timers now have the following new features:
- can init freq using floating point; eg tim.init(freq=0.1)
- tim.source_freq() added to get freq of timer clock source
- tim.freq() added to get/set freq
- print(tim) now prints freq
2014-10-05 17:52:44 +01:00
Damien George c3ab90da46 tests: Make printing of floats hopefully more portable. 2014-10-05 17:50:02 +01:00
Damien George d112cbfd7c Merge pull request #891 from stinos/windows-tests
windows tests fixes
2014-10-05 17:48:37 +01:00
stijn dc1ea1156a Exclude some tests which always fail on windows 2014-10-05 09:32:26 +02:00
stijn a2f9c9445a Enable unicode for Windows port so unicode tests give correct uPy output 2014-10-04 09:16:20 +02:00
Damien George 24119176e7 stmhal: Allow pyb.freq() function to change SYSCLK frequency.
Eg pyb.freq(120000000) sets the CPU to 120MHz.  The frequency can be set
at any point in the code, and can be changed as many times as you like.
Note that any active timers will need to be reconfigured after a freq
change.

Valid range is 24MHz to 168MHz (but not all freqs are supported).  The
code maintains a 48MHz clock for the USB at all times and it's possible
to change the frequency at a USB REPL and keep the REPL alive (well,
most of the time it stays, sometimes it resets the USB for some reason).
Note that USB does not work with pyb.freq of 24MHz.
2014-10-04 01:54:31 +01:00
Damien George c568a2b443 stmhal: Adjust computation of SYSCLK to retain precision. 2014-10-04 01:54:02 +01:00
Damien George 1f2558d647 Merge pull request #889 from Vogtinator/master
Implement missing ARM emitter functions for viper
2014-10-04 00:26:05 +01:00
Fabian Vogt e5268963c6 Implement missing ARM emitter functions for viper 2014-10-04 00:57:21 +02:00
Damien George 00be7a849a py: Fix unix-cpy to compile with uint->mp_uint_t changes. 2014-10-03 20:05:44 +01:00
Damien George 39dc145478 py: Change [u]int to mp_[u]int_t in qstr.[ch], and some other places.
This should pretty much resolve issue #50.
2014-10-03 19:52:22 +01:00
Damien George 3eaa0c3833 py: Use UINT_FMT instead of %d. 2014-10-03 17:54:25 +00:00
Damien George 42f3de924b py: Convert [u]int to mp_[u]int_t where appropriate.
Addressing issue #50.
2014-10-03 17:44:14 +00:00
Damien George 877dba3e1a drivers: Add NRF24L01 driver (written in pure Python).
Comes with test script.  Copy both files to pyboard and run
"import nrf24l01test".
2014-10-02 19:36:56 +01:00
Damien George e535a61983 tests: Add simple CAN test. 2014-10-02 17:32:02 +01:00
Damien George 3550de4ebe stmhal: Add basic CAN bus support. 2014-10-02 17:32:02 +01:00
Damien George 5fc6aa8100 stmhal: Set is_enabled=false when creating UART object; fix doc typo. 2014-10-02 17:31:37 +01:00
Damien George 0bbe4de527 stmhal: Update help text.
Remove reference to pyb.gc; add reference to pyb.millis.

There are lots of functions not listed when you run help(), but it would
be too much to list them all, so we list only some basic, useful ones.

Addresses issue #846.
2014-10-02 14:51:17 +01:00
blmorris 3b064370f8 Enable device keyword option when running pyboard.py --tests and run-tests --pyboard 2014-10-01 23:31:52 +01:00
Damien George 762d57519d unix: Do a proper clean-up on sys.exit/SystemExit.
Addresses issue #859.
2014-10-01 23:18:39 +01:00
Dave Hylands d368611ea6 Proposed fix for USB Mass Storage. 2014-10-01 22:52:02 +01:00