Commit graph

246 commits

Author SHA1 Message Date
Our Air Quality
5c885c7722 sysparam: export the 'compact' function, added it to the editor. (#213) 2016-11-24 00:41:39 +02:00
Our Air Quality
1728ef3dfc Flush the uart tx fifo before a restart. (#274)
Also comment the point at which the bus clock that drives the uart changes on startup and comment out the change in the uart divisor. This at least allows a consistent uart baud rate during a restart if using the rate 115200.
2016-11-18 11:34:03 +02:00
Our Air Quality
e48910ea3b Update and re-organise the sdk internal definitions. (#267) 2016-11-14 00:05:13 +02:00
Our Air Quality
a5cc728079 FreeRTOS type updates. (#261) 2016-11-05 12:04:03 +02:00
sheinz
e2e6f35288 Fix spiff and stdin_uart_interrupt overiding the same read function (#249)
* Fix spiff and stdin_uart_interrupt overiding the same read function

* Make strong function defninition replace a weak one
2016-11-01 17:14:34 +02:00
OurAirQuality
7bab80c33d FreeRTOS v9.0.0 upgrade 2016-10-25 23:35:51 +11:00
sheinz
29bd8d832a Merge pull request #222 from resetnow/phy-regs
core: add phy regs definition
2016-10-10 22:16:46 +03:00
Vlad Ivanov
94237f0ecd core: add phy regs definition 2016-09-15 22:31:45 +03:00
Vlad Ivanov
12d0da0c58 core: exception_vectors: initial esp-gdbstub support (#205) 2016-09-15 08:26:38 +02:00
Our Air Quality
4c78db81d8 sysparams: get/set int32 and int8 apis. (#209)
Rename the get/set_int api functions to get/set_int32.

Add get/set_int8 api functions too in anticipation of more efficient implementations for these.
2016-09-15 08:17:26 +02:00
sheinz
c2953eda38 Merge pull request #215 from pfalcon/pfalcon
esp/gpio_regs.h: Add info about strapping pins captured in GPIO.IN register.
2016-09-05 09:23:56 +03:00
sheinz
ad8764b9c6 Merge pull request #211 from ourairquality/gpio16
GPIO16 support.
2016-09-05 09:20:26 +03:00
Paul Sokolovsky
285dedd8f5 esp/gpio_regs.h: Add info about strapping pins captured in GPIO.IN register.
Specifically, in the high 16 bits of GPIO.IN register.
2016-09-04 23:20:29 +03:00
ourairquality
c52890eed7 GPIO16 support. 2016-08-31 11:30:32 +10:00
Paul Sokolovsky
0962255d91 esp/interrupts.h: Add RTC interrupt number.
40002a58     $a3 = rtc_intr_handler
40002a5e     $a4 = 0x0
40002a60     $a2 = 0x3
40002a62     call ets_isr_attach
2016-08-31 01:51:23 +03:00
sheinz
46840baed4 Merge pull request #196 from pfalcon/pfalcon
esp8266 headers: A new interrupt no and a new WDT register
2016-08-22 07:58:38 +03:00
Our Air Quality
762eced543 sysparam: add a semaphore to synchronize writers. (#194) 2016-08-21 07:47:40 +02:00
Paul Sokolovsky
0aabbea16f esp/wdt_regs.h: Add "current value" register.
WDT is countdown timer. Current value is accessible via VAL register. At
this time it's unclear if it's RO or RW (common sense says it shoul be RO).

Source: looking at the WDT registers on a running chip.
2016-08-20 16:13:07 +03:00
Paul Sokolovsky
458a6813c8 esp/interrupts.h: Add wDev FIQ interrupt number.
40251dd9     $a2 = 0x0
40251ddb     $a3 = wDev_ProcessFiq
40251dde     $a4 = 0x0
40251de0     $a0 = ets_isr_attach
40251de3     call $a0
2016-08-20 16:06:09 +03:00
Johan Kanflo
40dc3bf945 Sysparam by @foogod (#180)
* Sysparam implementation

sysparam improvements

Mostly done, a few minor cleanups left.

Add sysparam_editor example

Sysparam code cleanup

Add documentation to sysparam.h

Fix up sysparam.h docs

Added a couple more debug statements

Fix potential memory leak if realloc() fails

Major sysparam overhaul

Add sysparam_get_info function

Add sysparam initialization to app_main.c

* Fixed warnings, added license
2016-08-18 12:07:46 +02:00
sheinz
0875e5d55b Merge branch 'iomux-set-func' of https://github.com/ourairquality/esp-open-rtos into ourairquality-iomux-set-func
Conflicts:
	core/include/esp/iomux.h
2016-08-17 14:36:46 +03:00
sheinz
27135d6252 i2s_dma: Implementation of I2S + DMA wrapper library 2016-08-16 10:19:33 +03:00
ourairquality
4b77138f71 Add gpio_set_iomux_function(). 2016-08-15 22:23:45 +10:00
ourairquality
8405b989f9 iomux_set_function: remove the IOMUX_FUNC transform of the func argument.
The allows the IOMUX_GPIO<n>_FUNC_<function> definitions to be used here.
2016-08-15 22:10:59 +10:00
sheinz
22654a4de7 SPIFFS: Support lseek, stat, fstat
Support for lseek, stat, fstat added.
Test extended to covert those functions.
2016-07-14 16:13:03 +03:00
sheinz
6484c57737 Merge branch 'experiments/posix_fs' into feature/spiffs 2016-07-14 15:26:32 +03:00
Angus Gratton
678b59babf Honour values of configCPU_CLOCK_HZ & configTICK_RATE_HZ for tick rate
Fixes #147

* Can vary tick rate from 100Hz via configTICK_RATE_HZ. Note that the
  SDK binary libraries are hard-coded to assume the tick rate is 100Hz,
  so changing the tick rate may have unexpected consequences for lower
  layer WiFi behaviour (such as certain kinds of timeouts happening
  faster/slower.)

* Setting configCPU_CLOCK_HZ to 160MHz means ESP will set 160MHz during
  initialisation. Only 80MHz and 160MHz are supported.

* Timing of tasks is no longer affected by current CPU freq (whether set
  via configCPU_CLOCK_HZ or via sdk_system_update_cpu_freq().)
  Previously doubling the CPU frequency would double the tick rate.
2016-07-06 17:22:09 +10:00
Alex Stewart
8c9a77efe8 Added first half of RE'd user_interface.c 2016-07-06 17:21:34 +10:00
Alex Stewart
4d6fa0ccfa Misc post-merge fixups 2016-07-06 17:21:34 +10:00
Alex Stewart
2ecbf1d584 First batch of opensdk additions
Replacements for:
    libmain/misc.o
    libmain/os_cpu_a.o
    libmain/spi_flash.o
    libmain/timers.o
    libmain/uart.o
    libmain/xtensa_context.o
2016-07-06 17:21:34 +10:00
sheinz
b71a7ad237 Use SPIFFS for POSIX file access. Draft. Not tested. 2016-06-30 17:38:05 +03:00
Angus Gratton
04b119a61e Seed libc PRNG from hardware RNG on reset 2016-06-30 08:18:10 +10:00
Angus Gratton
4b39a0e6ca Merge pull request #136 from SuperHouse/feature/ota_improvements
OTA improvements, always enable OTA mode
2016-05-28 12:46:58 +10:00
Angus Gratton
230aa9fd37 Add new "RAM" storage macro for putting constant data in RAM
Also update comments in common_macros.h following #142
2016-05-28 12:39:56 +10:00
Angus Gratton
d9202af2aa Use latest upstream rboot, always build with OTA - use prebuilt rboot if
none is compiled locally.
2016-05-28 11:27:10 +10:00
Angus Gratton
6eceb5843c OTA: Move OTA-aware Cache_Read_Enable to core
Otherwise images built with OTA=1 are only OTA-suitable if they also
link rboot-ota.
2016-05-28 11:27:10 +10:00
Angus Gratton
f0db26604f brk/malloc: Allow malloc to fail when out of RAM
Fixes #76.
2016-05-27 12:09:07 +10:00
Angus Gratton
3ba19d7c4e Merge pull request #137 from SuperHouse/feature/better_crash_dumps
Better crash dumps
2016-05-17 09:38:19 +10:00
Angus Gratton
1e9296f60c Fatal exceptions: Cleanly deal with exceptions that occur inside fatal_exception_handler_inner()
In case of heap corruption or some other major problem, dumping details
in the exception handler can cause a crash loop - so fail out if we seem
to be going in circles.
2016-05-17 09:27:31 +10:00
Angus Gratton
981c87899b Add heap information to fatal exception & abort dumps 2016-05-15 22:30:01 +10:00
Angus Gratton
efedd24624 fatal exception handler: Only dump "registers" from stack for fatal user exceptions 2016-05-15 22:30:01 +10:00
Angus Gratton
36886412e6 Add abort() implementation
Also reduces the IRAM footprint of the fatal exception handler, as only
the prelude (which disables interrupts & enables the flash mapping) is
in IRAM now.

Closes #54, relevant to #133.
2016-05-15 22:30:01 +10:00
Angus Gratton
cf350efd8a Dump register state on fatal exception 2016-05-15 22:30:01 +10:00
Angus Gratton
52f9b13faf Break out debug dump functions into their own compilation unit 2016-05-15 22:30:01 +10:00
Angus Gratton
640609c3f5 lwip sys_arch: Add functional xInsideISR implementation
Relies on global flags set when the user ISR is executing.

Unclear if this fixes any bugs as ISR code may not have been calling
into LWIP, but the previous implementation was broken.
2016-05-15 22:30:01 +10:00
Angus Gratton
f9fb0f212c Add stack memory dump to fatal exception handler 2016-05-15 22:24:40 +10:00
Angus Gratton
fd20b1a530 Add PHY hardware management for Bluetooth Coexistence pin choice 2016-05-15 22:21:10 +10:00
Angus Gratton
b61d06e940 Wrap structure around phy_info PHY initialisation settings
Add notes based on testing some of the values found there.
2016-05-15 22:21:10 +10:00
Angus Gratton
fee987d5cf Startup code: Move user_start_phase2 to irom section
This saves 1020 bytes from the text (IRAM) section by preventing
inlining of user_start_phase2() (and dump_flash_config_sectors() as
well) into the IRAM function sdk_user_start().
2016-05-15 22:16:42 +10:00
Angus Gratton
dccc57433d Move static constructor calls to after PHY, clock & baud rate are setup
Otherwise anything printed inside the constructor happens at unexpected baud rate.

Ref #128
2016-04-24 18:52:20 +10:00
Angus Gratton
b61b62136b gcc __attribute__((constructor)): Remove hacked calling, move ctor sections to flash
More hacky moving of parts of .rodata to flash, until we can move all of
it.

Candidate fix for #128
2016-04-24 18:52:16 +10:00
UncleRus
3a62a0af0c esp/gpio.h c++ compatibility 2016-03-22 01:51:50 +05:00
UncleRus
42018f0315 SPI big endian swap bug fix, spi_get_settings()/spi_set_settings() 2016-03-18 03:27:36 +05:00
UncleRus
b0fb8736a8 Comments updated 2016-03-13 16:48:05 +05:00
UncleRus
22ceb08b49 Tabs to spaces. Again. 2016-03-13 02:25:15 +05:00
UncleRus
b4554b5806 SPI mode bug fixed, SPI endianness bugs fixed, new spi_transfer() 2016-03-13 01:59:52 +05:00
UncleRus
9dc565ff7c Separate send/receive buffers 2016-03-08 04:00:11 +05:00
UncleRus
b5c2120efc Removed redeclaration of peripheral bus freq 2016-03-06 01:24:59 +05:00
UncleRus
0e3f3bb2ca Frequency divider bug 2016-03-05 03:07:57 +05:00
UncleRus
bd40f75d37 Hardware SPI driver 2016-03-05 02:29:01 +05:00
Angus Gratton
2e8c370d2c Merge pull request #94 from foogod/gpio_pullup_changes
Separate pullup config out of `gpio_enable()`
2016-02-24 09:17:39 +11:00
Angus Gratton
d1091b69d1 Make the task stack overflow message clearer
Related to #96
2016-02-24 08:54:32 +11:00
Alex Stewart
8279b5cfd1 Added some clarifications to comments in esp/gpio.h 2016-02-22 09:32:12 -08:00
Alex Stewart
c36feab845 Separate pullup config out of gpio_enable()
Created `gpio_set_pullup` to configure pullups independently of direction.
Removed GPIO_INPUT_PULLUP direction type.
Added misc other helper functions in iomux.h
2016-02-21 18:34:11 -08:00
Angus Gratton
b4af009efe Add esp_gpio.c, including gpio_enable() function
Fix build broken since 812c2fef (unclear why previous commits didn't break?)
2015-12-01 09:56:40 +11:00
Angus Gratton
812c2fef21 Removed INLINED (force inline) macro.
Progress towards #57.
2015-11-28 18:01:03 +11:00
Angus Gratton
2887896c76 timers.h: Return error codes instead of true/false for failures 2015-11-28 16:33:39 +11:00
Angus Gratton
336bad573d timers.h: Remove compile-time-auto-inlining complexity
Fixes bug mentioned in #72 (oops!), also progress towards #57.
2015-11-28 16:32:52 +11:00
Johan Kanflo
4cfe40d348 extras/stdin_uart_interrupt: stdin via IRQ driven RX driver on UART0
See examples/terminal/ for usage
2015-11-21 16:15:58 +11:00
Angus Gratton
5301174290 registers.h: Add i2s, SLC, RTC register headers 2015-11-20 17:56:38 +11:00
Angus Gratton
d63a341c4c RTC registers: Add some notes about other register values
Still patchy, but more towards #8.
2015-11-20 17:49:46 +11:00
Angus Gratton
925753819e Add in-progress RTC register header (some registers still undocumented)
Author for this work is @foogod, extracted from 1da996e (open-libmain branch).

Progress towards #8.
2015-11-20 17:31:11 +11:00
Angus Gratton
547c57c840 Add SLC interrupt number 1. Closes #69 2015-11-20 17:25:15 +11:00
Dag Ågren
cad1655330 Add static asserts and create slc.h header for descriptor struct 2015-11-19 21:14:16 +02:00
Dag Agren
1f1bb4d190 Add I2S and SLC register headers 2015-11-16 00:20:16 +02:00
Angus Gratton
5cd31c649a GPIO2 UART iomux values: Remove _BLINK from macro name
This pin acts as a real TX not an activity LED as some pages suggest.
2015-10-28 20:31:50 +11:00
Angus Gratton
0165592231 iomux: Fix bug setting IOMUX_FUNC(4)
Function masking value was incorrect
2015-10-28 20:31:44 +11:00
Angus Gratton
c2e3541c05 Disable default line-buffering of stdout
As discussed in #52. Application can re-enable buffering on stdout with setbuf() or setbuf()
2015-10-11 09:21:30 +11:00
Angus Gratton
0c6a8881a4 Fix sdk_uart_rx_one_char implementation, move into sdk_compat.c 2015-10-06 23:48:28 +11:00
Angus Gratton
be3968abf0 stdout: Bring back auto-CRLF behaviour as discussed 2015-10-06 23:24:40 +11:00
Angus Gratton
7823a28ff8 Change default baud rate back to 74906bps, compatible with boot ROM rate
This reverts a behaviour change from 3ceadfc0a6.
2015-10-06 23:11:17 +11:00
Angus Gratton
cd68622292 Merge branch 'master' into uart_h 2015-10-06 18:37:28 +11:00
Angus Gratton
dc0fa4e207 Merge pull request #50 from SuperHouse/fix/interrupts
Fix/interrupts
2015-10-06 18:36:03 +11:00
Angus Gratton
12399c05ef exception_vectors: Use call0 for sdk__xt_int_exit, in case it needs a literal 2015-10-06 18:25:48 +11:00
Angus Gratton
0d35c0c02d exception_vectors.S: Use .Lnnn syntax for local labels, as noted by @foogod 2015-10-06 18:24:35 +11:00
Angus Gratton
0c0668bfa0 app_main: Refactor to use uart.h functions instead of raw register access
This removes the automatic insertion of CR ahead of LF by the SDK putc
function when called inside the SDK (although we'd already replaced
printf, so most were bypassing this putc function anyhow.)
2015-10-06 18:14:05 +11:00
Angus Gratton
3ceadfc0a6 uart.h: Add uart_get_baud/uart_set_baud functions, change default baud rate from 74906 to 115200 2015-10-06 17:49:00 +11:00
Alex Stewart
707d0ed981 Fix issue #52. Add esp/uart.h 2015-10-05 21:51:57 -07:00
Angus Gratton
afd58bc1ff core headers: Add C++ linker compatibility 2015-10-05 18:33:32 +11:00
Angus Gratton
d39b3f6bb6 NMI Handler: Save 512 bytes of RAM via NMI stack space. Add stack overflow detection. 2015-09-29 17:33:15 +10:00
Angus Gratton
697d5b72bc NMIExceptionHandler: Don't save callee-saved registers, fix stack alignment
NMI routine sdk_wDev_ProcessFiq seems to be written in C, meets ABI
calling conventions for callee-saved registers. Not sure why SDK
handlers saved them.

NMI handler now also meets the ABI requirement that stack is 16 byte
aligned (doesn't seem strictly necessary, but can't hurt.)
2015-09-29 15:05:57 +10:00
Angus Gratton
4448380c5e NMIExceptionHandler: Clean up, refactor to use excsave3 for stack pointer 2015-09-29 14:37:33 +10:00
Angus Gratton
89c481c606 Simplify interrupt and RTOS timer tick handlers
RTOS Timer tick handler is now the same as any other ISR.

This causes a few subtle behaviour changes that seem OK but are worth noting:

* RTOS tick handler sdk__xt_timer_int() is now called from one stack
  frame deeper (inside _xt_isr_handler()), whereas before it was called
  from the level above in UserHandleInterrupt. I can't see any way that
  the extra ~40 bytes of stack use here hurt, though.

* sdk__xt_timer_int() was previous called after all other interrupts
  flagged in the handler, now it's called before the TIMER FRC1 & FRC2
  handlers. The tick handler doesn't appear to do anything particularly
  timing intensive, though.

* GPIO interrupt (value 3) is now lower priority than the SPI
  interrupt (value 2), whereas before it would have been called before
  SPI if both interrupts triggered at once.
2015-09-29 13:21:04 +10:00
Angus Gratton
ed8470631f Consolidate interrupt management in core as esp/interrupts.h & esp_interrupts.c 2015-09-28 22:15:40 +10:00
Angus Gratton
fc9d9ff89c Merge branch 'experiments/unaligned_load' into feature/mbedtls_notworking 2015-09-25 16:57:49 +10:00
Alex Stewart
b813489524 Code reformat/cleanup of exception_vectors.S 2015-09-24 22:43:29 -07:00
Alex Stewart
b6c2e4df59 Fix bad memory access in NMI handler
CallNMIExceptionHandler was saving/restoring registers to the wrong offsets,
causing it to potentially corrupt the first two slots of the
LoadStoreErrorHandler's save area.
2015-09-24 20:12:14 -07:00
Angus Gratton
87f77b1021 Refactor Hardware RNG functions to esp/hwrand.h
As suggested by @foogod, thanks!
2015-09-24 20:48:16 +10:00
Angus Gratton
09405a9095 Merge branch 'master' into feature/mbedtls 2015-09-24 20:40:36 +10:00
Angus Gratton
c31b9be9a2 Merge branch 'experiments/unaligned_load' into feature/mbedtls 2015-09-24 20:25:10 +10:00