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
Alex Stewart
b15d149b09
More LoadStoreErrorHandler performance improvements
2015-09-23 08:51:36 -07:00
Alex Stewart
f1bff97103
Further optimizations for LoadStoreErrorHandler
2015-09-21 22:13:14 -07:00
Alex Stewart
b280f8a725
Fix format strings in app_main.c
2015-09-20 14:09:30 -07:00
Alex Stewart
ba7492756c
Merge branch 'master' into open-startup
2015-09-20 14:05:54 -07:00
Angus Gratton
b03f279f74
mbedTLS: Add ESP8266 hardware entropy source discovered by @foogod
...
Addresses #3 , provided turns out to be an effective HWRNG.
2015-09-20 21:15:30 +10:00
Angus Gratton
3aff91c85c
Rename GPIO_CONF_PUSH_PULL to GPIO_CONF_OPEN_DRAIN
...
Seems I got the functionality of this bit inverted when
initially testing.
In testing it also seems open drain mode is ignored on some pins, which
still source current. Needs more investigation though (may be pullups
internal to the ESP modules or set by default in software.)
Relates to #45
2015-09-20 21:13:38 +10:00
Angus Gratton
f31daa7f9a
iomux: Fix setting of invalid bits when masking in iomux fields
...
Fixes regression from 2a939e97
Part of issue #45
2015-09-20 21:13:38 +10:00
Angus Gratton
6c06e5e91e
common_macros: Include sys/cdefs.h, defines _Static_assert among others
2015-09-20 21:13:38 +10:00
Angus Gratton
1c8017484c
Move c++ operators back to link-time resolutions, part of 'core'
...
This reverts commit e9b1df5cb5
.
2015-09-20 21:13:38 +10:00
Angus Gratton
7be365ef08
gpio.h: Explicit cast to enum type (needed for g++)
2015-09-20 21:13:38 +10:00
Angus Gratton
6416fe7329
Post-merge cleanup of extras/cpp_support
2015-09-20 21:13:38 +10:00
Angus Gratton
94fabc6ceb
Add basic C++ new/delete operators, as contributed by @mikejac in #24
2015-09-20 21:13:38 +10:00
Angus Gratton
cc97067fa1
Add C++ support to Makefile, and proof-of-concept simple.cpp example
...
This is a work in progress based on @mikejac's work.
Missing:
* No 'new' operator.
* I don't think STL is currently supported.
2015-09-20 21:13:38 +10:00
Michael Jacobsen
372827ac42
Mostly updated header files for use in C++
2015-09-20 21:13:38 +10:00
Angus Gratton
f47aa77982
Moved DoubleLoadStorageHandler to end of functions, improve fast path l8ui performance
...
This allows a conditional branch that previously required a full jump instruction not to require it.
2015-09-15 15:09:42 +10:00
Angus Gratton
9cd23e08a4
Fix performance regression in 3911a94cc
2015-09-15 15:00:56 +10:00
Angus Gratton
7d779389ab
unaligned_load: Fix sign extension, add test case for sign extension
...
H/T to @foogod again for this.
2015-09-15 12:00:32 +10:00
Angus Gratton
c7a7dfdf82
Remove the unaligned load handler to its own source file as it was getting quite complex
...
The downside here is needing to use #include so the 'beq' in the
exception vector can land on it directly, save an instruction.
There might be a better way to do this, but it seems hard to "curate"
the order that symbols appear in each section.
2015-09-15 11:34:21 +10:00
Angus Gratton
3911a94cc8
Remove one more branch from l8ui code path
...
Thanks for @foogod for the heads-up on this.
2015-09-15 11:01:21 +10:00
Angus Gratton
26e1ce325e
Fix sign extension as suggested by @foogod
...
Also removes a branch from l8ui path, saves some cycles
2015-09-14 18:30:11 +10:00
Angus Gratton
259c9b643f
Exception vectors: Remove no-op syscallhandler
2015-09-14 18:17:45 +10:00
Angus Gratton
0e0c5d89b8
NMI exception handler: Fix reserving too much RAM for registers
2015-09-14 17:43:29 +10:00
Angus Gratton
9c15b757d3
Exception handlers: remove unused NMIHandlerAddress
2015-09-14 17:22:50 +10:00
Angus Gratton
0432ae3745
Use GPIO2 for led_debug.S
2015-09-14 17:20:00 +10:00
Angus Gratton
45d4e0da2d
Exception vectors: Rearrange to use absolute offets instead of .align hacks
2015-09-14 17:20:00 +10:00
Angus Gratton
a5a179beef
Extended unaligned load support to work from DoubleExceptionVector
...
Allows handling bad loads that occur inside level 1 exception handlers.
2015-09-14 17:20:00 +10:00
Angus Gratton
8b90dbd9e5
Merge branch 'feature/c++'
2015-09-12 16:27:26 +10:00
Angus Gratton
c45e84d61d
Rename GPIO_CONF_PUSH_PULL to GPIO_CONF_OPEN_DRAIN
...
Seems I got the functionality of this bit inverted when
initially testing.
In testing it also seems open drain mode is ignored on some pins, which
still source current. Needs more investigation though (may be pullups
internal to the ESP modules or set by default in software.)
Relates to #45
2015-09-12 16:21:26 +10:00
Angus Gratton
91d897dbbe
iomux: Fix setting of invalid bits when masking in iomux fields
...
Fixes regression from 2a939e97
Part of issue #45
2015-09-12 15:23:42 +10:00
Angus Gratton
ac0a947453
Merge branch 'master' into experiments/unaligned_load
2015-09-10 08:19:42 +10:00
Angus Gratton
1d7bfeeccd
Merge branch 'fix/int32_t'
...
Closes #42
2015-09-09 16:23:31 +10:00
Angus Gratton
7e73693898
Rework component makefiles to have a default <component>_ROOT
...
This fixes a long-standing bug where build directories sometimes
expanded many levels deeper than they should have.
Component names can now no longer contains slashes (ie the component
name for 'extras/i2c' is now just 'i2c')
2015-09-08 09:59:59 +10:00
Angus Gratton
7ed064a750
libc: Redefine int32_t/uint32_t as 'int' not 'long'
...
libc built from projectgus/newlib-xtensa@0077776963
Closes #42
2015-09-05 13:37:00 +10:00
Angus Gratton
920ee8bf85
libc syscalls: ENOSYS implementations for open,fstat,close,lseek
...
Closes #41
2015-09-03 11:45:52 +10:00
Angus Gratton
568ebc0fdc
libc read()/write() syscalls - return EBADF if fd is not stdin/stdout as applicable
...
As discussed in #41
Also fixes indent in _read_r
2015-09-03 11:34:54 +10:00
Alex Stewart
19f01b2f72
app_main.c: load correct g_ic sector from flash
2015-08-30 13:37:40 -07:00
Alex Stewart
8b5e8b923e
Bug fix for dump_flash_config_sectors
2015-08-30 12:11:08 -07:00
Alex Stewart
a88f36d986
More app_main.c fixups
...
It's alive! IT'S ALIVE!!
2015-08-28 18:53:43 -07:00
Alex Stewart
a9eb3a38e3
More app_main fixups from object code comparisons
2015-08-28 18:53:43 -07:00
Alex Stewart
aa7f305e16
Various app_main.c bug fixes
2015-08-28 18:53:43 -07:00
Alex Stewart
a044c061d5
Replace libmain:app_main.o with core/app_main.c
2015-08-28 18:53:43 -07:00
Alex Stewart
b0206d0ca6
Fix broken UART(i) definition
2015-08-25 22:31:47 -07:00
Angus Gratton
c824bcf74a
common_macros: Include sys/cdefs.h, defines _Static_assert among others
2015-08-26 11:11:31 +10:00
Angus Gratton
43ecec5470
Move c++ operators back to link-time resolutions, part of 'core'
...
This reverts commit e9b1df5cb5
.
2015-08-26 11:07:06 +10:00
Angus Gratton
c565e2b90d
gpio.h: Explicit cast to enum type (needed for g++)
2015-08-26 10:49:00 +10:00
Angus Gratton
fff17627d9
Merge branch 'master' into feature/c++
2015-08-26 10:46:48 +10:00
Angus Gratton
e9b1df5cb5
Post-merge cleanup of extras/cpp_support
2015-08-26 10:45:21 +10:00
Alex Stewart
e2e841c660
Remove 'packed' attribute from all regs structs
2015-08-25 17:13:13 -07:00
Alex Stewart
2a939e97b5
Remove unnecessary AND for VAL2FIELD macro
...
Added VAL2FIELD_M / SET_FIELD_M for rare cases when there might actually be some need for it.
2015-08-25 17:07:06 -07:00
Angus Gratton
22d35ed5f2
Merge pull request #29 from foogod/issue_8
...
Add more *_regs.h definitions
2015-08-24 16:14:19 +10:00
Angus Gratton
050b17adbe
Add a comment explaining commented out REG_BASE lines
...
Change was part of #27
2015-08-22 17:39:25 +10:00
Alex Stewart
2f3b82812b
Add esp/rtcmem_regs.h
2015-08-21 14:20:00 -07:00
Alex Stewart
fdbb361a60
Fix a couple of struct def issues with 2 previous commits
2015-08-21 14:06:38 -07:00
Alex Stewart
0b6dfb6080
Add more regs to esp/dport_regs.h
...
Added a bunch of definitions based on info in http://esp8266-re.foogod.com/wiki/Memory_Map#dport0
2015-08-21 13:59:20 -07:00
Alex Stewart
e88b5b8c4b
Add esp/uart_regs.h and esp/spi_regs.h
2015-08-21 13:56:23 -07:00
Alex Stewart
1ebb85b150
rename GPIO_CONF_DRIVER_ENABLE back to GPIO_CONF_PUSH_PULL
2015-08-21 09:54:20 -07:00
Alex Stewart
8263fce80f
Fix leftover IOMUX_FUNC_A/D references
2015-08-19 16:53:02 -07:00
Alex Stewart
d2231b7ff5
Cleanup a few comments in *_regs.h files
2015-08-19 16:50:56 -07:00
Alex Stewart
177ad281aa
Add esp/wdt_regs.h
2015-08-19 16:48:11 -07:00
Alex Stewart
4fa66ca391
Added esp/timer_regs.h and esp/dport_regs.h
2015-08-19 11:34:18 -07:00
Alex Stewart
b271e19b51
Replace stdint.h with esp/types.h in gpio_regs.h
2015-08-19 09:05:03 -07:00
Alex Stewart
b84a69168f
Fix cut-paste error in gpio_regs.h comment
2015-08-19 09:03:18 -07:00
Alex Stewart
fc1a1a7d0a
Add esp/gpio_regs.h
2015-08-18 22:46:25 -07:00
Alex Stewart
2ffd3da71e
Add esp/iomux_regs.h
2015-08-18 17:38:31 -07:00
Angus Gratton
7d480876fa
Add basic C++ new/delete operators, as contributed by @mikejac in #24
2015-08-13 08:33:07 +10:00
Angus Gratton
7f338e66cb
Unaligned load: Remove debugging variables
2015-08-11 16:25:35 +10:00
Angus Gratton
e3b24df043
Unaligned load: Shave a few more instructions off
2015-08-11 16:25:11 +10:00
Angus Gratton
3b3f5ea771
Unaligned loads: Only save working registers, use jump table to load non-working registers
2015-08-11 15:29:53 +10:00
Angus Gratton
8ea4ae27e2
Unaligned loader: Support l16si
2015-08-11 15:03:53 +10:00
Angus Gratton
773a046dc3
Unaligned loader: clean up, reduce number of registers
2015-08-11 14:23:41 +10:00
Angus Gratton
424dc0f3b0
Add C++ support to Makefile, and proof-of-concept simple.cpp example
...
This is a work in progress based on @mikejac's work.
Missing:
* No 'new' operator.
* I don't think STL is currently supported.
2015-08-10 16:14:30 +10:00
Michael Jacobsen
da6b5f74bb
Mostly updated header files for use in C++
2015-08-10 15:31:03 +10:00
Angus Gratton
bfd38cd1e2
Experimental support for storing const strings in SPI flash or IRAM
...
As discussed in #11
Known limitations:
- Only supports l8ui/l16ui
- Unoptimised load routine
- Not called from DoubleExceptionHandler but should be
- Doesn't restore state properly when falling through to fatal exception handler
2015-08-10 12:03:03 +10:00
Angus Gratton
d685581829
Syscall hander: Fix a3 save address
...
(SDK doesn't use syscall exception so bug probably never hit?)
2015-08-10 11:54:30 +10:00
Johan Kanflo
64a1e5598b
Correct prototype for sdk_uart_rx_one_char, kudos to @foogod
2015-08-07 13:26:06 +02:00
Angus Gratton
bed6907d22
Exception vector address must be 256 byte aligned
...
Not actually a problem with the current linker script as the address is
predetermined there at start of IRAM, but might as well be accurate
about it.
As per advice from @foogod on esp8266-re mailing list:
https://groups.google.com/d/msg/esp8266-re/1ljIY3Zttbo/HvzHSWOLCgAJ
2015-08-06 09:54:46 +10:00
Angus Gratton
19b8383069
Working TFTP server based OTA updates
...
Tested with 16MBit flash configuration, two rboot update slots.
Closes #10
2015-08-05 14:10:14 +10:00
Angus Gratton
aed843fc14
exception_vectors: Remove some cruft some the symbol table
2015-07-30 10:10:37 +10:00
Angus Gratton
efc454035c
Move all code paths touched by NMI to IRAM
...
Prerequisite for calling Cache_Read_Disable() for OTA updates.
Massive thanks due to @foogod and their xtobjdis tool, creating the call
graph of where the wDev_ProcessFiq touched (including in newlib, etc.)
would have otherwise been very painful:
https://bitbucket.org/foogod/xtobjdis
2015-07-29 16:47:33 +10:00
Angus Gratton
28fdebee92
gpio: Change gpio_write argument to bool
2015-07-29 10:35:15 +10:00
Angus Gratton
265cef7e00
Add some LED debugging assembler macros
...
Not used directly in esp-open-rtos but useful to keep around.
2015-07-28 11:19:01 +10:00
Angus Gratton
ed7ba52c9a
Add exception vectors & low-level handlers
...
At the moment these are almost bit-for-bit copies of the vector
behaviour in the RTOS SDK, but hopefully that will start to change.
Progress towards #2
2015-07-28 11:01:57 +10:00
Angus Gratton
86188c01fd
Merge branch 'newlib'
2015-07-15 16:01:18 +10:00
Angus Gratton
1d72ed3f70
Hardware timer support
2015-07-09 12:29:40 +10:00
Angus Gratton
2c1b1ab141
Minor core header cleanups
2015-06-18 09:04:45 +10:00
Angus Gratton
b7b16de429
Alias ets_printf directly to printf at link time
...
I thought maybe ets_printf had some special properties, but it doesn't
seem to have any so far.
2015-06-16 16:22:55 +10:00
Angus Gratton
aaef4b0644
Replace all binary SDK libc functions with newlib
...
Adds a new build step to remove the SDK object files listed in
<libname>.remove.
Closes #1 .
2015-06-16 14:21:24 +10:00
Angus Gratton
49268a33e1
Link against newlib from esp-open-sdk's libcirom, replace FreeRTOS heap management.
...
Compiles and runs, expects xtensa lock.c patch in newlib (will still run
otherwise but malloc/free and other functions will be non-memory-safe...)
2015-06-16 14:20:24 +10:00
Angus Gratton
1b0124cf05
Timer FRC1 & FRC2 registers
...
Mostly determined from reverse engineering and poking around.
Includes first "experiments" program with random bits and pieces for
poking at registers, may be useful to keep in source control but not
useful for writing actual programs.
2015-06-12 17:05:54 +10:00
Angus Gratton
c09167715e
Indentation fixes
...
- Fix dir-locals so emacs won't inject occasional tabs to case statements.
- Fix stray tab indentation in example programs. (Thx @pfalcon for pointing this out)
2015-06-09 09:00:32 +10:00
Angus Gratton
a59b1565e4
Better comments on esp_gpio_interrupts.c
2015-06-08 18:33:56 +10:00
Angus Gratton
0078252df3
Add GPIO config, interrupt registers, GPIO interrupt support, 'button' example
2015-06-08 18:20:29 +10:00
Angus Gratton
822533fd92
Interrupt support refactor
...
Write inline versions for SDK-based interrupt convenience functions.
2015-06-08 18:20:29 +10:00
Angus Gratton
0dbb6d31a5
Add IRAM attribute for IRAM loaded symbols, add to common FreeRTOS functions
...
Closes #7 .
It'd be nice to change the linker script so .text is always linked to
IROM instead of needing to objcopy each compiled file. The sticking
point for this is libgcc & libhal, which have symbols in .text that need
to be loaded to IRAM.
2015-06-08 18:19:59 +10:00
Angus Gratton
a476fb007e
Fix IROM macro
2015-06-08 17:58:10 +10:00
Angus Gratton
2c46be9825
Basic support for GPIOs 0-15.
...
Start new 'core' component for low-level parts
Progress towards #8
2015-06-08 12:09:34 +10:00