Commit Graph

18 Commits

Author SHA1 Message Date
Damien George df6567e634 Merge map.h into obj.h.
Pretty much everyone needs to include map.h, since it's such an integral
part of the Micro Python object implementation.  Thus, the definitions
are now in obj.h instead.  map.h is removed.
2014-03-30 13:54:02 +01:00
Damien George 9b196cddab Remove mp_obj_type_t.methods entry and use .locals_dict instead.
Originally, .methods was used for methods in a ROM class, and
locals_dict for methods in a user-created class.  That distinction is
unnecessary, and we can use locals_dict for ROM classes now that we have
ROMable maps.

This removes an entry in the bloated mp_obj_type_t struct, saving a word
for each ROM object and each RAM object.  ROM objects that have a
methods table (now a locals_dict) need an extra word in total (removed
the methods pointer (1 word), no longer need the sentinel (2 words), but
now need an mp_obj_dict_t wrapper (4 words)).  But RAM objects save a
word because they never used the methods entry.

Overall the ROM usage is down by a few hundred bytes, and RAM usage is
down 1 word per user-defined type/class.

There is less code (no need to check 2 tables), and now consistent with
the way ROM modules have their tables initialised.

Efficiency is very close to equivaluent.
2014-03-26 21:47:19 +00:00
Damien George c12b2213c1 Change mp_method_t.name from const char * to qstr.
Addresses issue #377.
2014-03-26 20:15:40 +00:00
Damien George c3d35c6ac7 stm: Put pyb module in ROM. 2014-03-08 16:40:08 +00:00
mux d0ffda91cc Fix usart_obj_tx_char 2014-02-17 21:49:07 +02: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
Damien George a71c83a1d1 Change mp_obj_type_t.name from const char * to qstr.
Ultimately all static strings should be qstr.  This entry in the type
structure is only used for printing error messages (to tell the type of
the bad argument), and printing objects that don't supply a .print method.
2014-02-15 11:34:50 +00:00
Damien George 698ec21e46 Make mp_obj_str_get_data return char* instead of byte*.
Can't decide which is better for string type, char or byte pointer.
Changing to char removes a few casts.  Really need to do proper unicode.
2014-02-08 18:17:23 +00:00
Damien George 51f3a6becd stm: Improved ADC module; add BOARD_NAME config value. 2014-01-25 16:30:47 +00:00
Damien George b5d13c309f stm: Fix USART3 init. Small edits to Makefile and other things. 2014-01-22 22:55:07 +00:00
Damien George 5fa93b6755 Second stage of qstr revamp: uPy str object can be qstr or not. 2014-01-22 14:35:10 +00:00
Damien George 55baff4c9b Revamp qstrs: they now include length and hash.
Can now have null bytes in strings.  Can define ROM qstrs per port using
qstrdefsport.h
2014-01-21 21:40:13 +00:00
Damien George 613eb25545 stm: Fix print methods with new kind argument. 2014-01-15 23:02:53 +00:00
Damien George 328708eb25 stm: Re-instate C debugging USART port (disabled by default).
See pyb_usart_global_debug variable.

Also did some work on USB OTG, but nothing working yet.
2014-01-13 00:20:06 +00:00
mux e98cc2b691 Fix usart_obj_tx_str
* Fix usart_obj_tx_str to send the actual string.
* Fix issue #126
2014-01-10 11:19:34 +02:00
Damien George 2d45429122 Use memcpy instead of strncpy; add usart.status to stm. 2014-01-09 22:04:45 +00:00
mux c70ac7bf71 Add USART Micro Python Bindings
* Add Micro Python bindings to usart.c
* Export USART python object to namespace pyb
2014-01-09 13:36:13 +02:00
Damien 8f7491a109 Add USART support, connected to stdio for REPL. 2013-10-26 18:01:48 +01:00