Commit Graph

38 Commits

Author SHA1 Message Date
Damien George 6b239c271c py: Factor out persistent-code reader into separate files.
Implementations of persistent-code reader are provided for POSIX systems
and systems using FatFS.  Macros to use these are MICROPY_READER_POSIX and
MICROPY_READER_FATFS respectively.  If an alternative implementation is
needed then a port can define the function mp_reader_new_file.
2016-11-16 18:13:50 +11:00
Damien George 6810f2c134 py: Factor persistent code load/save funcs into persistentcode.[ch]. 2016-11-16 16:14:14 +11:00
Paul Sokolovsky 8bc3fc20fe esp8266: Rename "machine" module implementation to use contemporary naming.
Previously they used historical "pyb" affix causing confusion and
inconsistency (there's no "pyb" module in modern ports; but people
took esp8266 port as an example, and "pyb" naming kept proliferating,
while other people complained that source structure is not clear).
2016-11-06 01:30:19 +03:00
Paul Sokolovsky 9514d847fe esp8266: Add MP_FASTCODE modifier to put a function to iRAM.
It can be used in the following manner:

void MP_FASTCODE(foo)(int arg) { ... }
2016-10-19 00:20:10 +03:00
Paul Sokolovsky 462748de0c esp8266/esp8266.ld: Move main.o to iROM. 2016-10-19 00:12:54 +03:00
Paul Sokolovsky e7e0d91be8 esp8266/esp8266.ld: Move modmachine.o to iROM. 2016-10-19 00:04:30 +03:00
Paul Sokolovsky 6566e3f6a8 esp8266/esp8266.ld: Move help.o to iROM. 2016-10-19 00:01:14 +03:00
Paul Sokolovsky 20d0271863 esp8266/esp_init_data: Auto-initialize system params with vendor SDK 2.0.0.
SDK 2.0.0 goes into boot loop if a firmware is programmed over erased flash,
causing problems with user experience. This change implements behavior
similar to older SDKs': if clean flash is detected, default system
parameters are used.
2016-10-18 15:18:07 +03:00
Paul Sokolovsky dba40afa70 esp8266/modmachine: Simplify SPI class implementation multiplexing.
modpybhspi now does the needed multiplexing, calling out to modpybspi
(bitbanging SPI) for suitable peripheral ID's. modmachinespi (previous
multiplexer class) thus not needed and removed.

modpybhspi also updated to following standard SPI peripheral naming:
SPI0 is used for FlashROM and thus not supported so far. SPI1 is available
for users, and thus needs to be instantiated as:

spi = machine.SPI(1, ...)
2016-09-04 20:33:11 +03:00
Paul Sokolovsky 4a33677c97 esp8266/esp8266.ld: Move modmachinewdt to FlashROM. 2016-09-03 20:44:24 +03:00
Radomir Dopieralski d076fae219 esp8266/modmachinespi: Add a factory method for SoftSPI/HSPI 2016-08-19 21:19:59 +03:00
Radomir Dopieralski 8e7dfea803 esp8266/modpybhspi: Add a HSPI module for hardware SPI support
This module uses ESP8266's SPI hardware, which allows much higher
speeds. It uses a library from
https://github.com/MetalPhreak/ESP8266_SPI_Driver
2016-08-19 21:19:59 +03:00
Paul Sokolovsky 3372f69586 esp8266/esp8266.ld: Increase firmware image size to 0x90000 (576K).
Of them, 0x87000 is irom0 segment.

This is required to ship increasing number of modules and examples
developed in teh course of ESP8266 port project.
2016-08-09 14:54:26 +03:00
Paul Sokolovsky 4d22ade102 esp8266: Enable btree module. 2016-07-31 02:39:59 +03:00
Paul Sokolovsky 6afd651f1e esp8266/esp8266.ld: Put axTLS to FlashROM. 2016-04-27 00:45:09 +03:00
Damien George df3b1741b6 esp8266: Separate 1-wire timing funcs from Python module to save iRAM.
esponewire.c contains low-level timing-critical functions that go in
iRAM.  modonewire.c contains Python wrapper code.
2016-04-14 12:44:26 +01:00
Damien George 1a0a323ca8 esp8266: Add initial implementation of machine.UART.
Currently UART(0) and UART(1) are exposed and only uart.write works.
2016-04-06 19:45:52 +03:00
Paul Sokolovsky 8d2bcaf3cd esp8266: Minimize gap between Inst/DataRAM segments and FlashROM segment.
With .rodata being in FlashROM now, gap can be much smaller now. InstRAM
can be max 32K, and with segment headers, that already makes it more than
32K. Then there's some .data still, and the next Flash page boundary is
0x9000. That figure should be more or less future-proof.

TODO: Refactor makeimg to take FlashROM segment offset from file name.
2016-04-03 15:45:14 +03:00
Paul Sokolovsky fcd6862597 esp8266: Bump iROM size to 512k.
Needed for frozen scripts, and for future growth of binary.
2016-04-03 00:57:27 +03:00
Paul Sokolovsky ef0c5db2ed esp8266: Move .rodata where it belongs with -mforce-l32 help. 2016-04-03 00:51:51 +03:00
Paul Sokolovsky cd6194aefc esp8266/esp8266.ld: Put FatFs to FlashROM. 2016-03-27 17:15:25 +03:00
Paul Sokolovsky 935e021250 esp8266: Put modpybi2c.o to FlashROM. 2016-03-26 10:59:25 +02:00
Paul Sokolovsky f71c0699a5 esp8266: Put utils.o to FlashROM. 2016-03-26 00:39:51 +02:00
Paul Sokolovsky 9c7e3353e5 esp8266: Put lexerstr32.o into FlashROM. 2016-03-26 00:39:02 +02:00
Damien George 632d8efa05 esp8266: Add PWM support.
PWM implementation uses a timer and interrupts (FRC1), taken from
Espressif's/NodeMCU's implementation and adapted for our use.

8 channels are supported, on pins 0, 2, 4, 5, 12, 13, 14, 15.

Usage:

    import machine
    pwm0 = machine.PWM(machine.Pin(0))
    pwm0.freq(1000)
    pwm0.duty(500)

Frequency is shared (ie the same) for all channels.  Frequency is
between 1 and 1000.  Duty is between 0 and 1023.
2016-03-26 00:32:37 +02:00
Damien George 82b95f625e esp8266: Implement software SPI class.
Supports speeds up to 500k baud, polarity=0/1, phase=0/1, and using any
pins.  Only supports MSB output at the moment.
2016-03-25 23:28:13 +02:00
Paul Sokolovsky 9d7b871f58 esp8266: Store frozen modules in FlashROM.
Requires special lexer to access their contents.
2016-03-17 23:06:47 +08:00
Damien George 3fbbbecec9 esp8266: Put more code in iROM section.
Also explicitly name the py/*.o files in the linker file, to enable easy
testing of putting certain ones in iRAM.
2016-03-08 11:31:39 +07:00
Damien George 05dda0ee9e esp8266: Enable modlwip. 2016-03-08 10:21:50 +07:00
Paul Sokolovsky 259f1344ca esp8266/esp8266.ld: Link in SDK version section.
Otherwise, os.uname() returns empty string for SDK version.
2016-03-03 15:37:19 +02:00
Damien George 6d0629bddc esp8266: Enable float support, using 30-bit stuffed floats.
No complex numbers though.
2016-03-02 22:43:10 +02:00
Damien George f09f8097d5 esp8266: Put more code in irom0 section, to get it building again. 2015-10-20 22:59:31 +01:00
Josef Gajdusek 7d8edeff4e esp8266: Update to SDK version 1.1.0 (MIT-licensed).
1. Updated linker script, now user app appears to contain exception vector
table and oesn't work (faults) without it.
2. Commened out support for GPIO pulldown, which was removed in this SDK
version without clear explanation, but apparently because it was released
without proper validation, and now turns out it doesn't work as expected,
or there's a different function there.
2015-05-30 20:58:59 +03:00
Damien George 304a96d7d6 esp8266: Put more literal and text obj data in irom0_0_seg.
With newer versions of esp_iot_sdk the iram1_0_seg started to overflow.
Now it doesn't.

Addresses issue #1254.
2015-05-13 14:49:14 +01:00
Josef Gajdusek b47931978f esp8266: Update the linker script
Moved modesp.o to flash and increased size of the irom0_0_seg segment. The new
value was taken from NodeMCU linker script.
2015-05-13 00:12:54 +01:00
Damien George e636279fe0 esp8266: Move more rodata to irom section.
rodata can only go in iram/irom if it's accessed only using word loads
(ie no byte or half-word access).
2014-11-29 14:36:18 +00:00
Damien George fbea810043 esp8266: Change bignum from mpz to longlong; move some rodata to iram.
Some rodata items can go in iram/irom segment, but not others.  With
this patch ESP now has 24256 bytes of heap ram.  It passes 228 out of
248 tests from tests/basics directory.
2014-11-28 14:58:25 +00:00
Damien George 075d597464 esp8266: New port of Micro Python to ESP8266 wifi module. 2014-11-27 20:30:33 +00:00