Commit graph

107 commits

Author SHA1 Message Date
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