Commit Graph

467 Commits

Author SHA1 Message Date
Daniel Campora 9249242119 cc3200: Remove unneeded loops in the FreeRTOS hooks. 2015-08-16 20:18:05 +02:00
Daniel Campora 641a3d39e1 cc3200: Make sure to update sleep objects when registered. 2015-08-16 20:18:02 +02:00
Daniel Campora 6ff2d54347 cc3200: Small renaming in wdt functions for the sake of consistency. 2015-08-16 20:18:00 +02:00
Daniel Campora 11d21081b4 cc3200: Rework SD API. Increase heap to avoid malloc failures. 2015-08-16 20:17:58 +02:00
Daniel Campora 34c290b678 cc3200: Rename SPI nss param to cs.
The nss param in the pyboard has a different meaning that doesn't
apply to the WiPy.
2015-08-16 20:17:55 +02:00
Daniel Campora ea5061e409 cc3200: Improve callback API.
Rename "wakes" param to "wake_from" and make "value" an object
instead of an integer.
2015-08-16 20:17:52 +02:00
Daniel Campora 4c5bfe2d10 cc3200: Server side SSL socket requires both certfile and keyfile. 2015-08-16 20:17:49 +02:00
Daniel Campora 7027fd5343 cc3200: Make ADC API compatible with the pyboard. 2015-08-10 23:42:05 +02:00
Daniel Campora 7da2fdc3cd cc3200: On the first boot, always make AP ssid='wipy-wlan'.
On the first boot don't add the MAC address, this is to speed up
factory testing.
2015-08-09 22:16:45 +02:00
Daniel Campora 2673374d18 cc3200: Refactor PRCM special user bits implementation. 2015-08-09 22:15:18 +02:00
Daniel Campora 651c870d77 cc3200: Speed up file system checking during start-up. 2015-08-09 22:09:16 +02:00
Daniel Campora aa3569cd57 cc3200: Add factory smoke test as part of the tools. 2015-08-09 19:22:26 +02:00
Daniel Campora 8cd9fedf58 cc3200: Add script to program the WiPy via UniFlash (windows only...). 2015-08-09 19:22:23 +02:00
Daniel Campora e23ae63970 cc3200: Fix bug in ffconf regarding '/flash' string length.
This bug was introduced when renaming '/sflash' to '/flash'.
2015-08-09 19:22:21 +02:00
Daniel Campora 31f6a6fa70 cc3200: Enable bootloader safe boot on latest firmware.
The first safe boot level executes the latest firmware but skips
'main.py' and 'boot.py'.
2015-08-09 19:22:19 +02:00
Daniel Campora e54a4f1f48 cc3200: Improve support for WEP security.
Key is always entered as a string, but if security is WEP, the key
is converted automatically to hex before connecting or configuring
the device as an AP.
2015-08-09 19:22:16 +02:00
Daniel Campora 00c4d6562e cc3200: Add nic.iwconfig() to set/get WLAN configuration.
Changes are based on this post:
https://github.com/micropython/micropython/issues/876#issuecomment-115255551

The constructor can optionally take the same params of iwconfig in
order to configure WiFi when creating the object. Params are
keyworkd only. The WiPy accepts:

- mode (int -> WLAN.AP or WLAN.STA)
- ssdi (string)
- security (int -> WLAN.OPEN, WLAN.WEP, WLAN.WPA, WLAN.WPA2)
- key (string)
- channel (int (1-11))
- antenna (int -> WLAN.INTERNAL, WLAN.EXTERNAL)
2015-08-09 19:22:12 +02:00
Daniel Campora c6926c374d cc3200: Make I2C and SPI API the same as in stmhal. 2015-08-02 20:22:15 +02:00
Daniel Campora aa58c7ec74 cc3200: Append last 2 bytes of the MAC address to the default SSID. 2015-07-30 00:43:16 +02:00
Daniel Campora b56634e691 cc3200: On ssl.read() or ssl.readall() ignore ssl layer closed error. 2015-07-30 00:43:14 +02:00
Daniel Campora fb3f9cff33 cc3200: Switch to 1 byte hash for QSTRs. 2015-07-30 00:43:13 +02:00
Daniel Campora 9a348fc840 cc3200: Add socket.makefile() 2015-07-30 00:43:10 +02:00
Daniel Campora 007878781c cc3200: Rename pins from GPIO to just GP.
This is how the names will be printed on the sticker that goes on top
of the EMI shield. The shorter names also help saving a few bytes of
RAM and ROM.
2015-07-30 00:43:08 +02:00
Daniel Campora f22b35e4e5 cc3200: Add socket.sendall() (aliases to send()).
Simplelink's socket send checks for the size of the packet and sends
it in chunks if the size is too large.
2015-07-17 11:38:01 +02:00
Daniel Campora a243d6b057 cc3200: Make socket stream methods return POSIX error codes. 2015-07-16 22:39:35 +02:00
Daniel Campora f738424403 cc3200: Remove superflous assignment since the result is not used. 2015-07-15 14:45:24 +02:00
Daniel Campora 753a8e8bc4 cc3200: Create /flash/cert folder if it doesn't exist. 2015-07-15 14:25:35 +02:00
Daniel Campora e955089da0 cc3200: Implement new OTA mechanism with 2 firmware update slots. 2015-07-15 14:25:28 +02:00
Daniel Campora cf814b2d34 cc3200: Refactor and clean-up socket closing code. 2015-07-10 11:37:50 +02:00
Daniel Campora ecb7f9fe58 cc3200: Set simplelink time and date when enabling WLAN. 2015-07-10 11:37:48 +02:00
Daniel Campora fa47bebfbc cc3200: Add struct weak link for ustruct. 2015-07-10 11:37:46 +02:00
Daniel Campora af33ebb13b cc3200: Increment telnet Tx retry delay on every try. 2015-07-09 17:30:17 +02:00
Daniel Campora 9220dc466a cc3200: Correct udelay us to ticks calculation. 2015-07-08 13:13:37 +02:00
Daniel Campora d18ced9cdd cc3200: Use alternative HAL_Delay also when interrupts are disabled. 2015-07-08 12:48:35 +02:00
Daniel Campora a0a3de60be cc3200: Translate simplelink's socket error numbers to POSIX values. 2015-07-07 16:13:54 +02:00
Daniel Campora 5685b565c3 cc3200: Create /flash/sys and /flash/lib directories while booting. 2015-07-07 16:13:40 +02:00
Daniel Campora 76e52b5daf cc3200: Make update-wipy.py more robust. 2015-07-07 16:11:48 +02:00
Daniel Campora fa655ce196 cc3200: Improve interrupt handling and fix bug in HAL_Delay(). 2015-07-07 16:11:05 +02:00
Daniel Campora 194c8c761e cc3200: Increment interrupt stack size from 2K to 3K. 2015-07-07 16:10:10 +02:00
Daniel Campora aaf7c5b35e cc3200/README.md: Improve make deploy instructions. 2015-07-04 16:39:05 +02:00
Daniel Campora c030e77861 cc3200: Enable base64 methods from modubinascii. 2015-07-04 16:33:54 +02:00
Daniel Campora 219a74c014 cc3200/README.md: Add notes about deploying a new software version. 2015-07-04 16:32:49 +02:00
Daniel Campora 31b40eebe8 cc3200: Fix socket recv and recvfrom return value type. 2015-07-02 23:17:22 +02:00
Daniel Campora 5161239c9f cc3200: time.sleep() now receives seconds, like CPython. 2015-07-02 17:23:22 +02:00
Daniel Campora 9a65fa304c cc3200: Add modussl, ssl sockets subclassed from normal sockets.
Stream methods were added to normal sockets as in the unix port.
2015-07-02 16:30:00 +02:00
Daniel Campora 7c1c9af5d4 cc3200: Code clean-up on pybpin. 2015-07-02 16:29:51 +02:00
Daniel Campora 4f8eeaedef cc3200: Set WLAN date/time via the rtc.datetime method().
WLAN needs time info when validating certificates.
2015-07-02 16:29:43 +02:00
Daniel Campora d680e28a11 cc3200: Optimize check for WLAN AP mode. 2015-07-02 16:15:59 +02:00
Daniel Campora 7fd538c1b6 cc3200: Raise an exception if trying to scan for networks in AP mode. 2015-07-02 15:03:58 +02:00
Daniel Campora f522849a4d cc3200: Add socket.timeout and socket.error exceptions. 2015-07-02 11:53:15 +02:00
Daniel Campora 70fc42cb28 cc3200: Add CA, certificate and key files to the updater list. 2015-06-30 22:11:15 +02:00
Daniel Campora 5ebf39784a cc3200: Correct socket settimeout time format. 2015-06-29 11:01:11 +02:00
Daniel Campora 4f5b896a0b cc3200: Adapt update-wipy.py timing to improve stability. 2015-06-28 14:14:24 +02:00
Daniel Campora 813b581127 cc3200: Add `Pin.name()` method. 2015-06-28 14:14:22 +02:00
Daniel Campora 778413168b cc3200: Enable more features to improve compatibility with stmhal. 2015-06-28 14:14:20 +02:00
Daniel Campora d02f671737 cc3200: Add deploy target and improve robustness of update-wipy.py. 2015-06-24 15:26:05 +02:00
Daniel Campora e64afde073 cc3200: Create tools folder and add update-wipy.py script.
This script is used by Jenkins to update the WiPy with the newly
built firmware before running the tests. It's not placed in the
common tools folder because it is very WiPy specific.
2015-06-24 12:36:38 +02:00
Daniel Campora 92d95cc9d3 cc3200: Remove --specs=nano.specs linker flag. 2015-06-18 09:01:37 +02:00
Daniel Campora ea2cc2b907 docs: Add more documentation for the CC3200 in the pyb module. 2015-06-16 15:45:24 +02:00
Daniel Campora cdfa11f550 cc3200: In Timer.callback() only use value param if in edge count mode. 2015-06-16 15:34:46 +02:00
Daniel Campora f28ed55aeb cc3200/README.md: Specify the board name in the build command. 2015-06-11 09:26:36 +02:00
Daniel Campora b630de1103 cc3200: Rename os.mkdisk() to os.mkfs(). 2015-06-10 23:35:45 +02:00
Daniel Campora 1811c6bccf cc3200: Remove Timer.AB constant.
Timer.A and Timer.B can be ORed for this purpose.
2015-06-10 23:35:43 +02:00
Daniel Campora e2dc7ac2a9 cc3200: Clarify notes about the extended functionality of uhashlib. 2015-06-10 23:35:41 +02:00
Daniel Campora 95cc1ff542 cc3200: Re-name pyb.hard_reset() to pyb.reset(). 2015-06-10 23:35:40 +02:00
Daniel Campora 330e21c986 cc3200: Use the pull up/down resistors on the antenna selection pins. 2015-06-10 23:35:38 +02:00
Daniel Campora f960d753e4 cc3200: Fix bootloader build error. 2015-06-10 23:35:36 +02:00
Daniel Campora 3319780e96 cc3200: Add sendbreak method to the UART. 2015-06-10 23:35:35 +02:00
Daniel Campora 8a6d93aeed cc3200: Make UART API more similar to stmhal. 2015-06-10 23:35:33 +02:00
Daniel Campora 640d00ea9d cc3200: Change MP_OBJ_NULL for mp_const_none in params default value. 2015-06-10 23:35:32 +02:00
Daniel Campora 071d47fa3b cc3200: Only kick the WDT if it's actually running. 2015-06-10 23:35:30 +02:00
Daniel Campora 6148f8b7d2 cc3200: Add contructor to the HeartBeat class. 2015-06-10 23:35:28 +02:00
Daniel Campora 371f4ba6b3 cc3200: Wrap antenna_init0() with #if MICROPY_HW_ANTENNA_DIVERSITY. 2015-06-08 10:38:19 +02:00
Daniel Campora 491c321720 cc3200: Re-config antenna selection when waking from suspended mode. 2015-06-07 13:28:47 +02:00
Daniel Campora b4a41a8f70 cc3200: Add missing antenna diversity source files. 2015-06-07 00:42:40 +02:00
Daniel Campora a3acaa000c cc3200: Add antenna selection feature to WLAN. 2015-06-07 00:06:27 +02:00
Daniel Campora a3cf4ea2f6 cc3200: Do not kick the watchdog inside the idle task. 2015-06-04 10:13:55 +02:00
Daniel Campora 71f85cc330 cc3200: Close ftp and telnet server sockets if listening fails. 2015-06-04 10:13:53 +02:00
Daniel Campora cc20482aa9 cc3200: Add method to configure the servers timeout.
With network.server_timeout(secs) the timeout can be changed.
The default value is 300 secs. Minimmum accpeted is 5 secs.
Without params the function returns the current configured timeout.
2015-06-03 17:31:21 +02:00
Daniel Campora 2ffb6e1b15 cc3200: Fix 'MP_QSTR_sd' undeclared error when building for the LAUNCHXL. 2015-06-02 13:11:01 +02:00
Daniel Campora 84d11b5e53 cc3200: Add period set method to the Timer class. 2015-05-29 15:54:46 +02:00
Daniel Campora 417205623a cc3200: Fix incorrect type for the wake cause variable. 2015-05-29 15:54:16 +02:00
Daniel Campora 2f2c0a13fb cc3200: Clean up WLAN API. Make WLAN.info() an attrtuple. 2015-05-29 15:48:41 +02:00
Daniel Campora 622f241317 cc3200: Rename pyb.reset() to pyb.hard_reset() and add pyb.unique_id(). 2015-05-29 10:22:20 +02:00
Daniel Campora 78744c4f7a cc3200: Remove WIPY-SD variant, and make the WiPy the default board. 2015-05-28 13:22:26 +02:00
Daniel Campora 2abb58d758 cc3200: Rename Pin.get_config() to Pin.info(). 2015-05-28 13:10:46 +02:00
Daniel Campora 1580e331ef cc3200: Make small changes in WLAN to improve the API. 2015-05-28 13:10:44 +02:00
Daniel Campora c754d8011d cc3200: Simplify SPI polarity and phase checks in constructor. 2015-05-27 09:45:32 +02:00
Daniel Campora 95104b0fbd cc3200: Add note about old revisions of the CC3200-LAUNCHXL. 2015-05-27 09:45:30 +02:00
Daniel Campora d07de2d307 cc3200: Move the STDIO UART pin configuration to mpconfigboard.h. 2015-05-27 09:45:29 +02:00
Daniel Campora 9414f92fa9 cc3200: Fix I2C and SPI module references. 2015-05-27 09:45:27 +02:00
Daniel Campora 8096be089e cc3200: Add make_new method to the WDT. 2015-05-27 09:45:25 +02:00
Daniel Campora fca3493442 cc3200: Add make_new method to the RTC, like in stmhal. 2015-05-27 09:45:24 +02:00
Daniel Campora 5a0c5f8fea cc3200: Use the WDT stall feature in debug mode only. 2015-05-27 09:45:22 +02:00
Daniel Campora ec1f0e7551 cc3200: Use MCU reset instead of SOC reset.
I have seen the CC3200 hanging a couple of times, and according to TI
itself the SOC reset is not reliable, which explains my observations.
2015-05-27 09:45:21 +02:00
Daniel Campora fabe79f7af cc3200: Clean up exception handling. 2015-05-26 12:29:20 +02:00
Daniel Campora 124aa000af cc3200: Use polarity and phase instead of submode in the SPI construct. 2015-05-26 11:30:48 +02:00
Daniel Campora 2dd47239de cc3200: Make API more similar to stmhal.
In general the changes are:

1. Peripheral (UART, SPI, ADC, I2C, Timer) IDs start from 1, not zero.
2. Make I2C and SPI require the ID even when there's only one bus.
3. Make I2C and SPI accept 'mode' parameter even though only MASTER
   is supported.
2015-05-25 21:47:19 +02:00
Daniel Campora 6545336206 cc3200: Make the WDT aware of the servers sleep/wake state. 2015-05-25 21:14:54 +02:00
Daniel Campora 5cd34aca27 cc3200: Use the correct ADC channel index when creating the object. 2015-05-25 21:14:46 +02:00
Daniel Campora 95f19b4542 cc3200: Remove duplicated checks for boot.py and main.py existency. 2015-05-25 21:14:39 +02:00
Daniel Campora 90d7c4ef3d cc3200: Make HeartBeat.disable() thread safe. 2015-05-25 21:14:31 +02:00
Daniel Campora 3cb804de26 cc3200: Remove NIC abstraction layer.
That layer is nice, but the CC3200 doesn't need it and getting rid of
it saves ~200 bytes, which are more than welcome.
2015-05-24 11:44:08 +02:00
Daniel Campora 9f8c5456be cc3200: Reset the servers and close user sockets on WLAN disconection.
This is needed to avoid half-open connections.
2015-05-24 11:44:06 +02:00
Daniel Campora ed56b0baba cc3200: Finally unlock the full wake on WLAN feature set. 2015-05-22 19:53:33 +02:00
Daniel Campora 18030bd85d cc3200: Add own ubinascii module.
The reason to have our owm ubinascii module is so that later we
can add crc32 support using the hardware engine.
2015-05-22 09:56:11 +02:00
Daniel Campora 7506db4ccb cc3200: Remove uhashlib.hexdigest(). 2015-05-21 18:51:57 +02:00
Daniel Campora e800db562f cc3200: Add uhashlib. Supports SHA1 and SHA256. 2015-05-20 11:44:24 +02:00
Daniel Campora 5e38b48dd6 cc3200: Fix time.localtime() so that it returns the correct fields. 2015-05-20 11:44:22 +02:00
Daniel Campora 56053c37cf cc3200: Rewrite WLAN.ifconfig(). Add WLAN.info() and WLAN.connections(). 2015-05-20 11:44:21 +02:00
Daniel Campora 514ba15d6a cc3200: Disable UCTYPES and enable ARRAY_SLICE_ASSIGN. 2015-05-20 11:44:19 +02:00
Daniel Campora 6f848b6dba cc3200: Set the timer edge count interrupt value in the calbback const. 2015-05-17 16:11:12 +02:00
Daniel Campora 95a4f61499 cc3200: Make sure RTC wake value is >= 1ms. 2015-05-17 16:09:27 +02:00
Daniel Campora c27dc38e85 cc3200: Re-name 'intmode' to 'mode' in the callback API. 2015-05-17 14:49:17 +02:00
Daniel Campora cd3f2523f1 cc3200: Disable WLAN.urn() by default.
Can be enabled by defining MICROPY_PORT_WLAN_URN=1 in mpconfigport.h.
2015-05-17 14:20:24 +02:00
Daniel Campora a379b6ed11 cc3200: Add optional timeout param to WLAN.connect(). 2015-05-17 14:05:44 +02:00
Daniel Campora fb9e4cf463 cc3200: Make sure to handle all pending pin interrupts.
When entering the interrupt handler of a given GPIO port, more than
one pin could have pending interrupts, therefore care must be taken
to service each interrupt one by one before leaving.
2015-05-17 13:42:15 +02:00
Daniel Campora 8e611e8414 cc3200: Add Timer module. Supports free running, PWM and capture modes. 2015-05-17 12:34:49 +02:00
Daniel Campora 9466e154b4 cc3200: Fix power mode param check in the UART callback constructor. 2015-05-17 12:26:40 +02:00
Daniel Campora 2b62707051 cc3200: Add os.rename() 2015-05-17 12:22:17 +02:00
Josef Gajdusek 1db4253886 lib: Move time utility functions to common library. 2015-05-13 00:12:54 +01:00
Damien George c50772d19f py: Add mp_obj_get_int_truncated and use it where appropriate.
mp_obj_get_int_truncated will raise a TypeError if the argument is not
an integral type.  Use mp_obj_int_get_truncated only when you know the
argument is a small or big int.
2015-05-12 23:05:53 +01:00
Daniel Campora 2bdefea9d6 cc3200: Enable MICROPY_MODULE_WEAK_LINKS. 2015-05-07 12:19:31 +02:00
Daniel Campora e04aa96b4d cc3200: Define MICROPY_CPYTHON_COMPAT=0.
This only disables some corner case functionality to keep C Python
compatibility, and saves ~600 bytes.
2015-05-05 11:23:06 +02:00
Josef Gajdusek 04ee5983fe lib: Move some common mod_network_* functions to lib/netutils. 2015-05-04 11:48:40 +01:00
Daniel Campora 8c8d7f3c60 cc3200: Clean up pyb.Pin
Remove unused and unneeded functions, also create Pin.get_config() that
returns the whole configuration of the pin.

This reduces code size by ~500 bytes.
2015-05-03 11:26:56 +02:00
Daniel Campora e4c899a08c cc3200: WLAN.ifconfig returns an attrtuple instead of a dictionary. 2015-05-03 11:26:25 +02:00
Daniel Campora f54bdecff2 cc3200: Implement Sleep.wake_reason() 2015-05-03 11:21:14 +02:00
Daniel Campora 71d482df47 cc3200: Clear the pending interrupt flag when disabling RTC callbacks. 2015-05-03 11:21:12 +02:00
Daniel Campora 6f218d7472 cc3200: Move wlan_init0() to the boot section.
This one creates a semaphore, therefore it must be executed only
after a hard reset (or when coming out of hibernation).
2015-04-29 16:10:40 +02:00
Daniel Campora d8713d78f5 cc3200: Correct Sleep module name. Must be 'Sleep', not 'sleep'. 2015-04-29 15:27:28 +02:00
Daniel Campora e282884e54 cc3200: When requesting safe boot, blink the led 3 times, not 4. 2015-04-29 15:27:21 +02:00
Daniel Campora dbb4aef5e3 cc3200: Make WLAN.isconnected() also work in AP mode.
While in STA mode isconnected() returns True when connected to an AP
and the IP has been acquired. In AP mode, WLAN.isconnected() returns
True if at least one connected station is present.
2015-04-29 15:26:21 +02:00
Daniel Campora bf4576dc91 cc3200: Clean-up servers enable/disable algorithm. 2015-04-29 14:25:44 +02:00
Damien George 95f53461c2 py: Replace py-version.sh with makeversionhdr.py, written in Python.
Also rename py-version.h to mpversion.h for consistency with mpconfig.h.
2015-04-28 23:52:36 +01:00
Daniel Campora d11317bcab cc3200: Make WLAN scan results a list of attrtupple.
Each result is displayed like this:

ssid='MySSID', bssid=b'\xc0J\x00z.\xcc', security=2, channel=None, rssi=-74

The CC3200 doesn't provide channel info, that why is 'None'.
2015-04-29 00:04:01 +02:00
Daniel Campora 5225e29ce7 cc3200: Remove unneeded -lgcc in Makefile. 2015-04-29 00:03:58 +02:00
Daniel Campora f81684141e cc3200: Implement os.uname() to get details of the OS and hardware. 2015-04-29 00:03:56 +02:00
Daniel Campora 6fefd5d330 cc3200: Move telnet_process_credential with the other private functions.
Just for consistency.
2015-04-29 00:03:54 +02:00
Daniel Campora f1ed8c8a2e cc3200: Improve telnet_parse_input() in case of an incomplete option. 2015-04-28 16:48:33 +02:00
Matt Anderson 0458833072 cc3200: Make telnet login procedure work with Tera Term.
This is actually a workaround Ter Term's issue of not obeying to the
telnet options that the server is sending. Therefore, we must buffer
chars until either a '\r' or the max length of the username/password
is received.
2015-04-28 16:48:26 +02:00
Daniel Campora 9fbc265eb8 cc3200: Add delays to allow the servers to start and stop properly. 2015-04-28 15:16:33 +02:00
Daniel Campora d34c4784a5 cc3200: Select NIC when the socket is created.
This makes sense since only WLAN is supported here.
2015-04-28 15:14:36 +02:00
Daniel Campora 7c8b4c1a8b cc3200: Correct MAKE_SOCKADDR and UNPACK_SOCKADDR byte order. 2015-04-25 23:36:45 +02:00
Daniel Campora eaefc8b9d6 cc3200: Add WiPy specific information to README.md 2015-04-22 21:03:10 +02:00
Daniel Campora df5d9c77f4 cc3200: Fix bootloader and modpyb after printf overhaul.
The bootloader needs string0.c because of memset, memcpy and others,
without string0.c it magically links, but calling any of those
functions results in a hard fault.
In debug mode, modpyb needs printf, and including stdio.h leads to
conflicts due to the redefinitions made in the simplelink drivers.
2015-04-19 20:59:10 +02:00
Damien George 259eaab9a9 cc3200: Clean up and reduce use/include of std.h. 2015-04-18 14:29:28 +01:00
Daniel Campora c1a77a0c9f cc3200: Use new %q format to print qstr's where appropiate. 2015-04-17 10:15:55 +02:00
Daniel Campora 2cd247e819 cc3200: Clean up bootloader makefile and remove superflous assert. 2015-04-17 09:55:24 +02:00
Damien George a86d40ccd4 cc3200: Get bootloader compiling with latest overhaul of printf code. 2015-04-16 14:30:17 +00:00
Damien George 7f9d1d6ab9 py: Overhaul and simplify printf/pfenv mechanism.
Previous to this patch the printing mechanism was a bit of a tangled
mess.  This patch attempts to consolidate printing into one interface.

All (non-debug) printing now uses the mp_print* family of functions,
mainly mp_printf.  All these functions take an mp_print_t structure as
their first argument, and this structure defines the printing backend
through the "print_strn" function of said structure.

Printing from the uPy core can reach the platform-defined print code via
two paths: either through mp_sys_stdout_obj (defined pert port) in
conjunction with mp_stream_write; or through the mp_plat_print structure
which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
on the platform.  The former is only used when MICROPY_PY_IO is defined.

With this new scheme printing is generally more efficient (less layers
to go through, less arguments to pass), and, given an mp_print_t*
structure, one can call mp_print_str for efficiency instead of
mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
Thumb2 archs.
2015-04-16 14:30:16 +00:00
Daniel Campora 4c37489f4c cc3200: Correct the IP address byte order in the FTP server. 2015-04-14 01:57:29 +02:00
Daniel Campora f7a26472af cc3200: Add IPPROTO_SEC to be able to create secure sockets. 2015-04-14 01:57:27 +02:00
Daniel Campora 99f7184073 cc3200: Disable MICROPY_COMP_TRIPLE_TUPLE_ASSIGN.
Because it's only a compiler optimization and increases code size.
2015-04-13 00:03:41 +02:00
Daniel Campora c69b4310c8 cc3200: Add WLAN.config_ip().
This new method allows to assign an static IP to the device.
2015-04-13 00:02:56 +02:00
Daniel Campora d278e49475 cc3200: Enable TRIPLE_TUPLE_ASSIGN and UBINASCII. 2015-04-11 13:35:07 +02:00
Daniel Campora 6e25d955f4 cc3200: Enable long filename support in FatFS.
This has implications all over the place. I have to admit that
you can instantly see that usability improves, but it costs 3K.
At the same time I took the oportunity to rename the '/SFLASH'
drive to '/flash' which improves compatibility with the pyboard.
2015-04-11 13:35:05 +02:00
Daniel Campora 18bd51707c cc3200: Enable the stdio UART for the LaunchXL only. 2015-04-07 12:12:16 +02:00
Daniel Campora c7acfc90b9 cc3200: Enable pull-ups for the STDIO UART pins. 2015-04-07 10:50:20 +02:00
Paul Sokolovsky 96b60ed956 cc3200: Fix typo after previous refactor. 2015-04-05 22:32:41 +03:00
Paul Sokolovsky 3a84c8b58d string0.c: Move from stmhal/ to lib/. 2015-04-05 21:57:55 +03:00
Daniel Campora b9d850227d cc3200: Add WLAN AP specific settings for each board. 2015-04-04 22:09:55 +02:00
Daniel Campora d460a30711 cc3200: Add specific version file for the CC3200 port.
Current version has been numbered as 0.9.0 since Timers/PWM support
is still missing.
2015-03-31 14:34:09 +02:00
Daniel Campora 3f42f32648 cc3200: Remove duplicated code from moduos.
Error reporting is also changed from detailed to terse, as with the
rest of the CC3200's modules. All this combined saves ~200 bytes.
2015-03-31 14:34:07 +02:00
Daniel Campora 7b19e99edd lib: Update FatFs to R0.11.
There are lots of cosmetic changes, but this release brings a  very
important bug fix:
 - Fixed f_unlink() does not remove cluster chain of the file.

With R0.10c if you try to write a file that is too large to fit in the
free space of the drive, the operation fails, you delete the incomplete
file, and it seems to be erased, but the space is not really freed,
because any subsequent write operations fail because the drive is
"still" full. The only way to recover from this is by formatting the
drive. I can confirm that R0.11 fixes the problem.
2015-03-29 22:12:14 +01:00
Daniel Campora 1eba62cac9 cc3200: Remove unneeded SPI instruction in the simplelink driver.
Setting the word count before a SPI transaction is only needed when
using DMA.
2015-03-26 20:50:39 +01:00
Daniel Campora 1826036a83 cc3200: Increase main stack size to 2K.
Increasing it from 1K to 2K gives more freedom to the callback
handlers, before this, simply nesting a function call into a
printf would cause a stack overflow.
2015-03-26 20:50:38 +01:00
Daniel Campora 760a6eca9b cc3200: Minor refactorings on modwlan and pybsleep. 2015-03-26 14:27:21 +01:00
Daniel Campora 4be44014ab cc3200: Reenable active interrupts when waking from suspended mode. 2015-03-26 13:58:58 +01:00
Daniel Campora 2d717ad97a cc3200: Add callback support to the UART for RX interrupts. 2015-03-26 10:28:43 +01:00
Daniel Campora e909e38871 cc3200: Remove superflous parameters from the SPI API. 2015-03-26 10:28:41 +01:00
Daniel Campora 7f41f650de cc3200: Remove superflous params from the I2C API. 2015-03-25 16:56:14 +01:00
Daniel Campora 26d230419c cc3200: Add GPIO25 to the pins list of the WiPy and the WiPy-SD.
This allows to properly initialize the system led and add it
to the sleep module so that it can be restored when resuming
from suspended mode.
2015-03-25 15:22:32 +01:00
Daniel Campora 4729a212b1 cc3200: Rename the WiPy_SD to WiPy-SD. 2015-03-25 15:22:27 +01:00
Daniel Campora 684dba40f0 cc3200: Roll back to the previous telnet and ftp timeouts.
Unfortunately, these timeouts are the only realiable way (for now), to
be able to detect broken connections due to half-open sockets. Such a
thing occurs when getting out of the WiFi coverage area or when
disconnecting from the AP (sometimes the client doesn't send the
disconnect packet).
2015-03-25 15:22:21 +01:00
Daniel Campora e15f8198bc cc3200: Keep WLAN enabled during the soft reset. 2015-03-25 15:22:16 +01:00
Daniel Campora 9d3588f2be cc3200: Remove the cc3200.xml file. Latest CCS already ships with it. 2015-03-25 15:22:11 +01:00
danicampora 104a867447 cc3200: Fix bug in telnet that caused the rx buffer to overflow. 2015-03-22 11:32:12 +01:00
danicampora 59f6831336 cc3200: Reduce soft reset time. WLAN is not reinit, just reenabled. 2015-03-21 11:31:29 +01:00
danicampora 77791b5633 cc3200: Improve usability and robustness of the servers. 2015-03-21 11:31:17 +01:00
danicampora c1c23e2f6a cc3200: Remove superfluous code in pybsleep. 2015-03-21 11:27:26 +01:00
danicampora cd9bc14c8f cc3200: Add SPI module.
Only MASTER mode is supported. Transfer width is configurable to
8, 16 or 32 bits.
2015-03-21 11:26:47 +01:00
danicampora c45e641c1d cc3200: Re-name pybsystick to mpsystick. 2015-03-21 11:21:45 +01:00
danicampora f8ee88bbe0 cc3200: Move server methods from WLAN to the network module. 2015-03-19 17:08:25 +01:00
danicampora 0e96d1b3f1 cc3200: Add parameter to wlan_stop() for custom timeout values. 2015-03-18 21:55:08 +01:00
danicampora f382f4442e cc3200: Fixes and improvements to the SD card driver. 2015-03-18 21:55:02 +01:00
danicampora 963d7c7ee6 cc3200: Refactor I2C. Remove all references to SLAVE mode. 2015-03-18 21:54:41 +01:00
danicampora d3912549a3 cc3200: Improve I2C timeout handling. 2015-03-18 21:54:30 +01:00
danicampora 005a7f4190 cc3200: Fix extint_enable behaviour when the callback is updated. 2015-03-17 13:26:09 +01:00
danicampora 181fe5016c cc3200: Add RTC callback with wake-up from sleep capability. 2015-03-17 13:26:08 +01:00
danicampora 6de1b39368 cc3200: Make peripheral objects static.
This prevents duplication of objects in the sleep list. Also helps
with reducing the code size by ~100 bytes.
2015-03-17 13:26:07 +01:00
danicampora fcf6db0695 cc3200: Register pybsd with the sleep module and use pin_config(). 2015-03-17 13:26:06 +01:00
danicampora 98b8568362 cc3200: Assign GPIO10 and GPIO11 to the GPIO peripheral on start-up. 2015-03-17 13:26:05 +01:00
danicampora ea43fa104e cc3200: Remove unneeded functions and add pybsleep_remove() calls. 2015-03-17 13:26:03 +01:00
danicampora 78d7c45b69 cc3200: Disable all wake sources on start-up. 2015-03-16 00:42:16 +01:00
danicampora ed20ac56f7 cc3200: Fix bug in RTC msec register access functions. 2015-03-16 00:42:15 +01:00
danicampora 5dd8ae6b9c cc3200: Fix spaces aligment in LAUNCHXL/mpconfigboard.h 2015-03-16 00:42:13 +01:00
danicampora 0962358026 cc3200: Align SD card driver with new SDK release(1.1.0). 2015-03-16 00:42:13 +01:00
danicampora 1080802e8f cc3200: Update socket event handler to align with new SDK(1.1.0) API. 2015-03-16 00:42:11 +01:00
danicampora dc545d6512 cc3200: Do not reset the DTHE module before every SHA operation.
According to the new SDK (1.1.0) this is not needed, and it's best
not to do it, because this module is a shared resource.
2015-03-16 00:42:10 +01:00
danicampora b2cb75efb7 cc3200: Remove double administration of callback objects. 2015-03-16 00:42:09 +01:00
danicampora c292632b59 cc3200: Update simplelink SPI driver to SDK release version 1.1.0. 2015-03-16 00:42:06 +01:00
danicampora 0d0646d915 cc3200: Update HAL to SDK release version 1.1.0. 2015-03-16 00:42:05 +01:00
danicampora 2c103d5200 cc3200: Rewrite the PRCM RTC functionality methods.
This allows to use the On-Chip retention registers for both the
RTC and to share notification flags between the bootloader and the
application. The two flags being shared right now are the "safe boot"
request and the WDT reset cause. we still have 2 more bits free for
future use.
2015-03-14 10:08:47 +01:00
danicampora d432bcb9ac cc3200: Prevent multiple memory allocations if sflash init fails. 2015-03-14 10:08:46 +01:00
danicampora 2ae17def52 cc3200: Clean up linker scripts and startup file. 2015-03-14 10:08:45 +01:00
danicampora 09721e2314 cc3200: Increase heartbeat period from 3 to 5 seconds. 2015-03-14 10:08:44 +01:00
danicampora c7fabe1f3e cc3200: Remove unneeded code from modwlan and optimize startup time.
These changes also help reduce the hibernate wake-up time to 1s.
2015-03-14 10:08:43 +01:00
danicampora 04749e677f cc3200: Allow separate selection of the power mode in Pin callbacks. 2015-03-12 16:22:17 +01:00
danicampora 10f7ef0832 cc3200: Keep WLAN enabled during suspend mode. 2015-03-12 16:22:16 +01:00
danicampora d1ba8b7659 cc3200: Correct WiPy's pinout and the pin generation script. 2015-03-12 16:22:15 +01:00
danicampora 6ae9383f63 cc3200: Remove WLAN.getmode since it's superseded by WLAN.ifconfig. 2015-03-12 16:22:13 +01:00
danicampora 37337427c3 cc3200: Trigger a new network scan when WLAN.scan() is called. 2015-03-12 16:22:12 +01:00
danicampora b761ed2103 cc3200: Register ADC and I2C with the sleep module. 2015-03-11 22:09:52 +01:00
danicampora db0580d0a5 cc3200: Reduce stack sizes of simplelink and the servers. 2015-03-11 22:09:51 +01:00
danicampora e9786f40f5 cc3200: Disable WLAN in suspended mode if NW wake is not enabled. 2015-03-11 17:11:10 +01:00
danicampora 8cbbaa052a cc3200: Add WiPy and WiPy_SD board support. 2015-03-11 17:00:38 +01:00
danicampora 9e44383e3f cc3200: Add power management framework. Add mpcallback class.
Supports suspend and hibernate modes. Waking is possible throug GPIO
and WLAN.
The mpcallback class is generic and can be reused by other classes.
2015-03-11 17:00:33 +01:00
danicampora 73aee8da54 cc3200: Merge ExtInt class into Pin class.
Also add another method to change the pin's interrupt mode
on the fly.
2015-03-11 17:00:28 +01:00
danicampora 26cbc91373 cc3200: Place functions only used while booting in a special section.
Such functions are never used after MicroPython has started, and they
remain in RAM wasting space. Now they are placed in a special section
named "boot" which sits just before the heap, allowing us to extend
the effective heap area up to the new boot section. Right now, this
gives us back ~1K, but in the future, more functions might end up in
there as well.
2015-03-11 16:59:29 +01:00
danicampora 02fda44a30 cc3200: Combine and disable sections in startup_gcc.c to reduce size. 2015-03-11 16:54:14 +01:00
danicampora d226dd2f59 cc3200: Add preliminary low power deep sleep support. 2015-03-11 16:54:09 +01:00
danicampora 0475de1350 cc3200: Make WDT and HeartBeat constant objects on their own right. 2015-03-11 16:54:05 +01:00
danicampora d01060241a cc3200: Add heartbeat signal on system led. 2015-02-28 19:03:21 +01:00
Johan Hendriks 6a41bf99bd cc3200: Create separate release/debug build directories 2015-02-28 19:03:17 +01:00
danicampora 74589cbeeb cc3200: Move code that disables/enables servers to wlan_sl_enable(). 2015-02-26 11:19:15 +01:00
danicampora 5330d8996f cc3200: Modify simplelink FreeRTOS OSI layer to only use semaphores.
Before, both mutexes and semaphores were used. Using only the latter
and with a bit of cleanup to remove some code bloat, we save ~600
bytes of code.
2015-02-26 11:18:18 +01:00
danicampora f3661d4100 cc3200: Change PRCM_PeriphRegs_t fields to unsigned char.
This helps saving ~300 bytes. Thanks to dpgeorge.
2015-02-25 23:25:23 +01:00
danicampora 7a074a14ce cc3200: Implement safe boot pin and system led behaviour.
The safe boot pin, when pulled high during reset rolls back the
firmware to the "factory" image and skips execution of 'boot.py'
and 'main.py'. This is useful to recover from a crash condition.
The system led is used mostly to signal errors.
2015-02-25 23:17:17 +01:00
danicampora 8a5aee103d cc3200: Fix md5 application signing, add missing accents. 2015-02-25 23:17:12 +01:00
danicampora 11aa6ba456 cc3200: Add WDT functionality as part of the pyb module.
Also improve pybsd, and make it save it's pin configuration.
This is a necessary step towards supporting the CC3200 low
power deep sleep (LPDS) mode.
2015-02-25 11:37:29 +01:00
danicampora fe2eb5f58a cc3200: Update README.md to add step for flashing the bootloader. 2015-02-25 11:36:56 +01:00
danicampora 70b3160871 cc3200: Introduce MICROPY_PORT_HAS_TELNET and MICROPY_PORT_HAS_FTP.
These definitions help on making modwlan.c usable by other ports
with the CC3100.
2015-02-23 15:02:57 +01:00
danicampora 379a3fa305 cc3200: Change UART.print() to make it consistent with the rest. 2015-02-23 15:02:55 +01:00
danicampora 88b7f52ebb cc3200: Replace WLAN.get_ip() with WLAN.ifconfig().
Also change other methods' names to make them consistent.
2015-02-23 15:02:55 +01:00
danicampora 44bb616b53 cc3200: Add simplelink non-os task calls. 2015-02-22 18:59:50 +01:00
danicampora 4bfc491753 cc3200: Add wlan_urn() thanks to Nadim El-Fata and Bryan Morrissey. 2015-02-22 18:43:01 +01:00
danicampora 0c11b167a7 cc3200: Add optimization flags to drivers/cc3100 in the debug build. 2015-02-22 17:50:52 +01:00
danicampora 33ddb566a7 cc3200: Remove dependencies from FreeRTOS.
Use the simplelink wrappers instead. This is one step further
towards having a single module for the cc3200 and the cc3100.
2015-02-22 17:50:50 +01:00
Damien George 3611c1de14 drivers/cc3100: Remove dependence on debug.h. 2015-02-21 22:04:07 +00:00
danicampora 92ea99a0fb cc3200: Add support for connecting to WEP secured networks. 2015-02-21 22:27:54 +01:00
danicampora 18605b36dc cc3200: Rename SD.config() to SD.config_pins(). 2015-02-21 22:27:48 +01:00
danicampora 7102e51506 cc3200: Add UART __del__ method. 2015-02-21 22:27:44 +01:00
danicampora a7208bcc43 cc3200: Remove sd paths from sys path when disabling the sd card. 2015-02-21 22:27:39 +01:00
Damien George 5ca1f5f9d9 cc3200: Get compiling with CC3100 driver from drivers/ directory. 2015-02-21 19:55:57 +00:00
Damien George 49c2ad4fb4 cc3200: Move CC3100 driver from cc3200/simplelink to drivers/cc3100.
This commit will not build, it exists just to track changes.
2015-02-21 19:52:07 +00:00
Damien George 36e2845e36 cc3200: Replace physical tabs with spaces.
Preparing this to move to drivers/ directory, want to make it as similar
to original code from TI as possible.
2015-02-21 19:48:34 +00:00
Damien George 4a23a01945 cc3200: Add explicit py/ path-prefix for py includes.
This is how it should be, so one knows exactly where the includes are
coming from.
2015-02-21 18:58:43 +00:00
danicampora 59d14914cd cc3200: Correct pybsd_config() params retrieval. 2015-02-21 14:26:38 +01:00
danicampora c020109cfa cc3200: Add SD module and disable SD card support for the LAUNCHXL. 2015-02-21 14:19:40 +01:00