Commit graph

277 commits

Author SHA1 Message Date
Angus Gratton
31ae3fe683 make: Use order-only prereq to check python dependencies 2018-08-23 08:28:57 +02:00
Roland Dobai
62cad3a7d7 Add python-future by using python requirements file 2018-08-23 08:28:57 +02:00
Angus Gratton
ff2404a272 Merge branch 'master' into feature/cmake 2018-08-16 17:14:17 +10:00
Angus Gratton
e75a1129e0 Merge branch 'bugfix/bootloader_noreturn_always' into 'master'
bootloader: Ensure bootloader never returns to caller

See merge request idf/esp-idf!2815
2018-07-23 11:56:14 +08:00
Angus Gratton
f0d74b1c64 bootloader: Ensure bootloader never returns to caller
* Fixes some "noreturn" functions in bootloader utils which did return (causing fatal CPU
  exceptions).
* Marks bootloader entry as "noreturn", preventing "user code done" from stalling boot
  Partial fix for https://github.com/espressif/esp-idf/issues/1814 TW20016
  (Comprehensive fix for this issue will be enabling WDT during bootloader, coming shortly.)
2018-07-19 16:24:11 +10:00
Angus Gratton
57b601ab7f secure boot: Pad to avoid data after the signature mapping into the address space
Because address space is mapped in 64KB pages, it was possible for unauthenticated data after the
app .bin to become mapped into the flash cache address space.

This problem is solved by 2 changes:

* "esptool elf2image --secure-pad" will pad the image so that the signature block ends close to the
  64KB boundary. Due to alignment constraints it will be 12 bytes too short after signing (but
  with flash encryption, these 12 bytes are still encrypted as part of the last block and can't be
  arbitrarily changed).
* By default, secure boot now requires all app partitions to be a multiple of 64KB in size.
2018-07-17 15:33:47 +10:00
Angus Gratton
8b5a2ccb8d docs: Update Flash Encryption docs to clarify reflashing options 2018-07-13 16:18:07 +10:00
Angus Gratton
6fd6e024fc bootloader: Fix warning building reflashable Secure Boot image 2018-07-13 15:45:15 +10:00
Angus Gratton
7b9009ca5c bootloader: Fix secure boot & flash encryption functionality
Fixes regression in 3e0ac4db79.
2018-07-13 15:26:18 +10:00
Ivan Grokhotkov
5551b3f616 bootloader: move iram_seg 1k up to have better looking idf_monitor output
When 2nd stage bootloader loads the ROM bootloader, it prints a
message similar to "entry 0x40080xxx", which idf_monitor decodes
(using application ELF file) as one of the reset vectors (xxx is <
400h). This moves the iram_seg of bootloader 1k up to prevent overlap
of bootloader .text and application vectors, making the output look
nicer. There is still a chance that the entry point decodes as some
symbol in application ELF file, but at least it won't have
"Exception" in its name.
2018-07-04 12:33:11 +08:00
Angus Gratton
d0b8f2865f docs: Switch base URL from esp-idf.readthedocs.io to docs.espressif.com 2018-06-19 11:23:33 +00:00
Angus Gratton
bf10447b82 cmake: Fix issues when IDF_PATH is not set in environment
Support cases where IDF_PATH may be passed in on the cmake command line,
or inferred from a (hardcoded absolute or relative) path to project.cmake
2018-06-18 14:48:03 +10:00
Angus Gratton
43b6c76bba Merge branch 'feature/expansion_space_for_bootloader' into 'master'
partition_table: Moving to custom offset

See merge request idf/esp-idf!2263
2018-06-18 12:34:53 +08:00
Ivan Grokhotkov
b2f498f7da build: allow EXCLUDE_COMPONENTS to contain quotes
'dequote' macro can’t be used at this point yet, use subst directly.
Also prevent EXCLUDE_COMPONENTS from being passed to bootloader build.
2018-06-11 23:26:56 +08:00
Konstantin Kondrashov
3e0ac4db79 partition_table: Expanding the space under the bootloader
Allows you to move the partition table, it gives more space for the bootloader.
Added a new utility - parttool.py. This utility can search for the offset and/or size of the partitions by name and type/subtype. Use for getting APP_OFFSET and PHY_DATA_OFFSET.
The linker(esp32.bootloader.ld) made changes that allow you to write a custom bootloader code more.

TW14125
2018-06-08 18:47:29 +05:00
Angus Gratton
6b9784cc45 Merge branch 'master' into feature/cmake_update 2018-05-31 14:46:23 +10:00
Konstantin Kondrashov
ae10abff2f bootloader: Add factory reset and start test app
Added feature:
- reset firmware to Factory app.(by long pressing of the button)
- boot Test app. (by long pressing of the button)
- Added feature erase data partitions from factory reset.

TW10281
TW10280
2018-05-24 16:56:49 +05:00
Angus Gratton
858b95a924 cmake: Add build system tests 2018-04-30 09:59:20 +10:00
Angus Gratton
1cb5712463 cmake: Add component dependency support
Components should set the COMPONENT_REQUIRES & COMPONENT_PRIVATE_REQUIRES variables to define their
requirements.
2018-04-30 09:59:20 +10:00
Angus Gratton
12be399762 cmake: Add link-time dependencies for linker script files
Requires some hackery around limitations in CMake's LINK_DEPENDS
2018-04-30 09:59:20 +10:00
Angus Gratton
88df8fd293 cmake: Use cmake_lint project, tidy up all CMake source files 2018-04-30 09:59:20 +10:00
Angus Gratton
abef220b13 cmake: Allow selecting toolchain file based on config
Refactor IDF "project" functionality under a wrapping of the default
"project" command, so we can tweak it a bit...

Will need more testing in other environments.
2018-04-30 09:59:20 +10:00
Angus Gratton
e94db98e73 link bootloader to libgcc (shouldn't be necessary, is necessary...) 2018-04-30 09:59:20 +10:00
Angus Gratton
3fac2b2ddc cmake: Refactor bootloader_subproject into the bootloader component itself 2018-04-30 09:59:20 +10:00
Angus Gratton
674d398c93 cmake: Add partition table, and .bin file targets 2018-04-30 09:59:20 +10:00
Angus Gratton
134f2238bd cmake: Refactor main cmake project logic 2018-04-30 09:59:20 +10:00
Angus Gratton
c671a0c3eb build system: Initial cmake support, work in progress 2018-04-30 09:59:20 +10:00
Konstantin Kondrashov
86256b3541 bootloader: Refactoring
Need to make the bootloader modular so that users can redefine its functional part.

- refactoring and moving functions to the bootloader_support component
- Changed function to `void` bootloader_utility_load_image(...);

TW19596
2018-04-17 16:36:49 +05:00
Roland Dobai
744c2dcdd9 Resolve problems found by enabling -Wwrite-strings compilation flag 2018-04-10 08:53:43 +02:00
Angus Gratton
da27816314 Merge branch 'feat/add_efuse_cpu_freq_rating' into 'master'
efuse/add cpu freq rating

See merge request idf/esp-idf!1994
2018-03-29 05:59:52 +08:00
Liu Zhi Fu
072b353b45 bootloader: force SDIO 1.9V if flash is 80M
If the SPI flash frequency is 80M, the voltage of SDIO is 1.9V,
otherwise, it can configured to 1.8V or 1.9V via menuconfig.
2018-03-19 16:39:54 +08:00
Darian Leung
8b1277c55f efuse/add cpu freq rating
This commit adds support for CPU max freqeuency rating
bits in CPU. Bootloader will now print an error if attempting
to 160MHz rated ESP32 at 240MHz.

EFUSE_CHIP_VER_RESERVE has been replaced by the
frequency rating bits. Dependancies on EFUSE_CHIP_VER_RESERVE
have been changed to use EFUSE_CHIP_VER_PKG
2018-03-07 12:16:51 +08:00
Anton Maklakov
301751ede0 build system: Fix undefined variables
make/project.mk:315: warning: undefined variable `CC'
    make/project.mk:316: warning: undefined variable `LD'
    make/project.mk:317: warning: undefined variable `AR'
    make/project.mk:62: warning: undefined variable `MAKECMDGOALS'
    components/partition_table/Makefile.projbuild:24: warning: undefined variable `quote'
    components/bootloader/Makefile.projbuild:123: warning: undefined variable 'BOOTLOADER_DIGEST_BIN'
    components/bootloader/Makefile.projbuild:123: warning: undefined variable 'SECURE_BOOTLOADER_KEY'
2017-12-28 19:21:34 +08:00
Angus Gratton
c69af42b96 esp32: Fix backwards compatibility for pre-v2.1 bootloaders
Older bootloaders don't set RTC_XTAL_FREQ_REG or call rtc_clk_init(),
app needs to pick this up.

Reported at
https://esp32.com/viewtopic.php?f=2&t=3939&p=17836
2017-12-18 13:45:57 +11:00
Ivan Grokhotkov
bad8d3ce57 bootloader: don't log anything before uart_console_configure is called 2017-12-08 13:15:40 +08:00
Angus Gratton
fccc30d2d5 bootloader: Only apply VDDSDIO 1.8V->1.9V if regulator is enabled
Fixes bug if regulator is disabled via efuse.
2017-11-27 10:33:41 +11:00
Alexey Gerenkov
692a890232 esp32: Adds Stack Smashing Protection Feature
These changes add posibility to enable GCC stack protector via menuconfig
for all source files in project.
2017-11-17 12:08:36 +03:00
Ivan Grokhotkov
afa9a85396 bootloader: wait for UART FIFO to be empty before switching frequency 2017-11-09 13:17:58 +08:00
Wangjialin
d034bc9ca0 bootloader: add configuration of flash pins and VDDIO boost 2017-11-03 16:29:56 +08:00
Ivan Grokhotkov
5a88f90a33 soc/rtc: warn if detected XTAL frequency does not match configured one
Since 9a8c0392, XTAL frequency is set to 40MHz by default, and users
of 26MHz boards need to select 26MHz manually. Most users are not aware
of this change, and existing getting started guides do not mention that
XTAL frequency needs to be set for some boards. So users are left with
garbage output from UART without any clue what to check.

This change adds a warning in case specific XTAL frequency was set, and
it does not match automatically detected one. This should help users
fix the issue.
2017-09-11 11:42:26 +08:00
krzychb
672390c458 Mass replacement of http with https urls, fixed broken urls 2017-09-06 08:16:01 +02:00
Angus Gratton
8670844acf build system: Restore ifdef/ifndef in Makefiles, clean up examples build 2017-09-05 16:11:03 +10:00
Deomid Ryabkov
9903ea1c11 Add --warn-undefined-variables to MAKEFLAGS
Fix warnings where undefined vars are used.

Make Kconfig emit "FOO=" for unset bool options
To ensure make variables are always defined, even if empty.

When writing auto.conf, include symbols disabled by dependency to make sure all make variables are always defined.

Fixes espressif/esp-idf#137

Cherry-picked from https://github.com/espressif/esp-idf/pull/138
2017-09-05 16:10:46 +10:00
Angus Gratton
11a87ca811 Merge branch 'bugfix/bootloader_ota_sel' into 'master'
Fix bootloader OTA regression

See merge request !1205
2017-09-05 07:25:08 +08:00
Angus Gratton
f487bb19d7 Merge branch 'bugfix/ci_build_examples_more' into 'master'
CI build_examples: Fix build flakiness

See merge request !1191
2017-09-04 16:02:12 +08:00
Angus Gratton
c275ad4ca4 build system: Add dependencies to component clean steps
Build directory must exist, component_project_vars.mk must be generated if it is going to be.
2017-09-04 17:40:15 +10:00
Angus Gratton
1cd2ce2471 bootloader: Fix regression preventing OTA updates
Regression introduced in 43e231c.

Thanks to @yanbe for pointing out issue in https://github.com/espressif/esp-idf/pull/955

This is a different fix, tries to keep the behaviour that 43e231c was aiming to correct (unnecessarily testing an
invalid slot more than once.)
2017-09-04 17:37:28 +10:00
Jeroen Domburg
34372a091c Add initial SPI RAM support. This adds support for an ESP-PSRAM32 chip connected to the default flash pins and GPIO 16 and 17. The RAM is mapped to address 0x3F800000, but otherwise ignored by esp-idf as of yet. 2017-09-04 12:05:49 +08:00
Jeroen Domburg
518edac42f Add GD chip into qio data, so (at least my) ESP-WROVER uses QIO mode succesfully. 2017-09-01 16:53:05 +08:00
Angus Gratton
7a18575af8 flash encryption: Also always disable ROM BASIC console when enabling flash encryption 2017-08-29 14:52:00 +10:00
Angus Gratton
43e231c916 bootloader: Don't unnecessarily test OTA app slots more than once per boot
Would loop more than once through each OTA possibility, but really only
needs to try each slot once.
2017-08-23 11:19:42 +10:00
Angus Gratton
5eef5e7a5d bootloader: Fallback if OTA data is invalid
Make bootloader more robust if either OTA data or some OTA app slots are corrupt.
2017-08-15 09:42:19 +10:00
Ivan Grokhotkov
967611cfaa Revert "bootloader: Add option to build with Link Time Optimisation enabled"
This reverts commit d1b66a08c1.
2017-07-24 05:14:31 +08:00
Angus Gratton
871ba41a09 bootloader: Remove unnecessary KEEP on data/bss sections, save static RAM 2017-07-19 18:31:59 +10:00
Angus Gratton
d1b66a08c1 bootloader: Add option to build with Link Time Optimisation enabled 2017-07-19 18:31:59 +10:00
Angus Gratton
17adb40ca8 bootloader: Calculate SHA256 hash of image on every boot
Makes app image booting more reliable (256-bit rather than 8-bit verification.)

Some measurements, time to boot a 655KB app.bin file and run to app_main() execution.

(All for rev 1 silicon, ie no 340ms spurious WDT delay.)

80MHz QIO mode:
before = 300ms
after = 140ms

40MHz DIO mode:
before = 712ms
after = 577ms

40MHz DIO mode, secure boot enabled
before = 1380ms
after = 934ms

(Secure boot involves two ECC signature verifications (partition table, app) that take approx 300ms each with 80MHz CPU.)
2017-07-19 18:31:59 +10:00
Angus Gratton
0c8888d68f bootloader: Combine loading from flash & verifying to save boot time
Still needs updating to account for secure boot.
2017-07-19 18:25:17 +10:00
Angus Gratton
ec64fa3416 bootloader flash QIO mode: Restore DIO/DOUT mode if enabling quad fails
Previously, flash was degraded to single I/O mode.
2017-07-19 15:04:09 +10:00
Angus Gratton
0715d1f8c1 bootloader: When customising SPI flash pins in efuse, set WP pin in menuconfig
Allows custom configurations for QIO/QOUT mode.
2017-07-19 15:04:08 +10:00
Angus Gratton
d664e32394 build system: Use component.mk for all components, refactor bootloader build
For config-only components, component.mk should now contain "COMPONENT_CONFIG_ONLY := 1"

Also refactored some of the generation of linker paths, library list. This required cleaning up the way the bootloader
project works, it's now mostly independent from the parent.
2017-07-19 09:10:48 +10:00
Angus Gratton
2b0f623259 bootloader/early boot: Error out if >192KB of static DRAM is allocated (temporary fix)
Currently the last 128KB of DRAM is reserved for the bootloader & early boot stacks. This means if >192KB of static DRAM
is allocated, the only available heap is this region - which is disabled until the scheduler starts. As a result, you
get either heap corruption on early boot if the static data overlaps startup heap (leading to very weird errors), or
FreeRTOS will fail to start when it can't malloc() anything.

Long term fix is to move the stacks & bootloader data to the very end of RAM, and only reserve that part for early
boot. This is a little fiddly because of also wanting to make sure this memory is not preemptively fragmented when it
gets reintroduced to the heap. This will become more important if/when we have more static allocation options in the
future.

For now, these errors make it clear why the boot has failed.

Ref TW13909
2017-07-12 13:06:56 +08:00
Ivan Grokhotkov
75658ee29b bootloader: workaround for clock switching bug in ESP32 rev. 0
In ESP32 rev. 0, switching between 240MHz and 80MHz (even via an
intermediate frequency of 40MHz) may cause the chip to lock up.
The bootloader used to enable 80MHz CPU clock at startup, which could
cause lock up after software reset. With this change, if 240MHz CPU
clock is enabled in menuconfig, bootloader will also use 240MHz to avoid
lock-up.
2017-06-15 18:15:35 +08:00
jack
ba32dd30a1 bugfix:Fix bug that wdt reset information for CPU1 was not correct 2017-06-05 18:26:14 +08:00
Tian Hao
26a3cb93c7 component/soc : move dport access header files to soc
1. move dport access header files to soc
2. reduce dport register write protection. Only protect read operation
2017-05-09 18:06:00 +08:00
Tian Hao
f7e8856520 component/esp32 : fix dualcore bug
1. When dual core cpu run access DPORT register, must do protection.
2. If access DPORT register, must use DPORT_REG_READ/DPORT_REG_WRITE and DPORT_XXX register operation macro.
2017-05-08 21:53:43 +08:00
Ivan Grokhotkov
fe695a9af8 Merge branch 'feature/cpu_restart_sequence' into 'master'
Restart sequence requires set up for app cpu.

These changes required to make correct restart of CPU form JTAG.

See merge request !703
2017-04-27 09:30:42 +08:00
Ivan Grokhotkov
0fe765a977 Merge branch 'feature/32k_xtal' into 'master'
add support for 32k XTAL as RTC_SLOW_CLK source

- RTC_CNTL_SLOWCLK_FREQ define is removed; rtc_clk_slow_freq_get_hz
  function can be used instead to get an approximate RTC_SLOW_CLK
  frequency

- Clock calibration is performed at startup. The value is saved and used
  for timekeeping and when entering deep sleep.

- When using the 32k XTAL, startup code will wait for the oscillator to
  start up. This can be possibly optimized by starting a separate task
  to wait for oscillator startup, and performing clock switch in that
  task.

- Fix a bug that 32k XTAL would be disabled in rtc_clk_init.

- Fix a rounding error in rtc_clk_cal, which caused systematic frequency
  error.

- Fix an overflow bug which caused rtc_clk_cal to timeout early if the
  slow_clk_cycles argument would exceed certain value

- Improve 32k XTAL oscillator startup time by introducing bootstrapping
  code, which uses internal pullup/pulldown resistors on 32K_N/32K_P
  pins to set better initial conditions for the oscillator.

Ref TW11683.

Ref https://esp32.com/viewtopic.php?f=13&t=1570

Fixes https://github.com/espressif/esp-idf/issues/337.

See merge request !696
2017-04-26 14:01:59 +08:00
Dmitry Yakovlev
00aa73c6cf Restart sequence requires set up for app cpu. 2017-04-26 07:47:37 +03:00
Ivan Grokhotkov
6353bc40d7 Add support for 32k XTAL as RTC_SLOW_CLK source
- RTC_CNTL_SLOWCLK_FREQ define is removed; rtc_clk_slow_freq_get_hz
  function can be used instead to get an approximate RTC_SLOW_CLK
  frequency

- Clock calibration is performed at startup. The value is saved and used
  for timekeeping and when entering deep sleep.

- When using the 32k XTAL, startup code will wait for the oscillator to
  start up. This can be possibly optimized by starting a separate task
  to wait for oscillator startup, and performing clock switch in that
  task.

- Fix a bug that 32k XTAL would be disabled in rtc_clk_init.

- Fix a rounding error in rtc_clk_cal, which caused systematic frequency
  error.

- Fix an overflow bug which caused rtc_clk_cal to timeout early if the
  slow_clk_cycles argument would exceed certain value

- Improve 32k XTAL oscillator startup time by introducing bootstrapping
  code, which uses internal pullup/pulldown resistors on 32K_N/32K_P
  pins to set better initial conditions for the oscillator.
2017-04-26 12:43:22 +08:00
Angus Gratton
08cfcbb6ea bootloader: Add some debug logging around OTA selection 2017-04-26 11:23:35 +10:00
Angus Gratton
e2479b46f7 secure boot: Fix bootloader image verification failure
* Failure prevented secure boot from enabling.
* Also adds unit test cases for esp_image_basic_verify()

Ref https://esp32.com/viewtopic.php?f=2&t=1602
TW11878
2017-04-26 11:23:35 +10:00
Ivan Grokhotkov
6b237de909 Add XTAL frequency selection to Kconfig
This change allows XTAL frequency to be selected using menuconfig
2017-04-24 15:55:02 +08:00
Alexey Gerenkov
77a92e6dcc esp32: Added dumping info from traceport upon reset by any WDT
- Last PC info and waiti mode indication are printed for both CPUs
 - Raw traceport regs values are printed only for log levels higher than DEBUG
2017-04-23 22:07:56 +03:00
Ivan Grokhotkov
15ec487fde Merge branch 'feature/esp32_d2wd_support' into 'master'
ESP32-D2WD support

Support ESP32-D2WD with integrated flash in ESP-IDF.

Includes fix for https://github.com/espressif/esp-idf/issues /521


See merge request !639
2017-04-14 20:57:39 +08:00
Angus Gratton
f7793840e1 bootloader: Add QIO support for ESP32-D2WD SPI flash 2017-04-13 17:55:47 +10:00
Angus Gratton
85e76a7cfc spiflash ROM functions: Remove Quad I/O mode enable/disable code from flash ROM functions
Confusion here is that original ROM has two functions:

* SPIReadModeCnfig() - sets mode, calls enable_qio_mode/disable_qio_mode
* SPIMasterReadModeCnfig() - As above, but doesn't set QIO mode in status register

However we never want to use the ROM method to set/clear QIO mode flag, as not all flash chips work this way. Instead we
do it in flash_qio_mode.c in bootloader.

So in both cases (ROM or "patched ROM") we now call SPIMasterReadModeCnfig(), which is now named
esp_rom_spiflash_config_readmode().
2017-04-13 17:54:42 +10:00
Ivan Grokhotkov
9edab21385 Merge branch 'feature/rtc_clk_impl' into 'master'
Introduce soc component, add source of rtc_clk and rtc_pm libraries

This MR adds parts of the RTC library source code (initialization, clock selection functions, sleep functions). WiFi-related power management functions are kept inside the precompiled library. Most of RTC library APIs have been renamed.

Default CPU frequency option in Kconfig is set to 160MHz, pending qualification of 240MHz mode at high temperatures.

Register header files are moved into the new soc component, which will contain chip-specific header files and low-level non-RTOS-aware APIs (such as rtc_ APIs). Some of the files from ESP32 component were also moved: cpu_util.c, brownout.c, and the corresponding header files. Further refactoring of ESP32 component into more meaningful layers (chip-specific low level functions; chip-specific RTOS aware functions; framework-specific RTOS-related functions) will be done in future MRs.

See merge request !633
2017-04-12 10:38:23 +08:00
Ivan Grokhotkov
7ee8ee8b7e soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
Alexey Gerenkov
0860f46220 spi_flash: Fixed bug in SPI flash ROM driver to work with embedded flash chip
1) fixed SPI_read_status: added check for flash busy flag in matrix mode
2) fixed SPI_page_program: enable write before writing data to SPI FIFO
3) SPI flash ROM funcs replacement is controlled via menuconfig option
2017-04-11 10:51:19 +08:00
Ivan Grokhotkov
61c33ca24e make: don’t override TEST_COMPONENTS
When idf_monitor is launched from make, it gets modified TEST_COMPONENTS
variable which contains full paths to the test components instead of the
names. This causes TEST_COMPONENT_PATHS to be empty and the unit test
app gets built without any test components.

This change introduces an internal TEST_COMPONENTS_LIST variable which
gets set either from $(COMPONENTS) if TESTS_ALL is 1, and from
TEST_COMOPONENTS otherwise.
Bootloader makefile is also fixed to avoid propagating TESTS_ALL to the
bootloader build step.
2017-03-09 19:43:39 +08:00
Ivan Grokhotkov
8911e666a0 Merge branch 'feature/docs_partition_ota_flash' into 'master'
Partition/SPI/OTA docs & OTA new functionality

* Update partition, SPI flash & OTA docs to reflect functionality changes
* Refactor OTA implementation to perform checks mentioned in API doc
* Add new functions to OTA API: esp_ota_get_running_partition() & esp_ota_get_next_update_partition() functions
* Add spi_flash_cache2phys() & spi_flash_phys2cache() functions to support esp_ota_get_running_partition()


See merge request !513
2017-03-03 11:27:01 +08:00
Ivan Grokhotkov
848494b20f Merge branch 'feature/enable_qio_directly' into 'master'
Enable SPI flash Quad I/O in bootloader

Bootloader checks flash ID, enables Quad I/O mode based on flash type.

See merge request !479
2017-03-03 11:25:52 +08:00
Angus Gratton
c3544dc090 Build system: Fix error if librtc submodule not available to bootloader
Closes #220 https://github.com/espressif/esp-idf/issues/220
2017-02-22 11:59:37 +11:00
Angus Gratton
1f3a2e900c docs: Improve/clarify partition, OTA & SPI flash docs
Related to #313 https://github.com/espressif/esp-idf/issues/313
2017-02-20 15:31:42 +11:00
XiaXiaotian
eb14284c92 disable PHY and RF when stop WiFi and disable BT
1. Add disable PHY and RF when WiFi and BT are both disabled(including call sniffer disable API).

2. Do not init PHY and RF when cpu start. Init PHY and RF when call Wifi or BT start APIs(including sniffer enable API).

3. Add a temporary lib: librtc_clk.a and will delete it when CPU frequency switching function is done.

4. Add an function to get OS tick rate.

5. Do not put the whole pp.a in iram0, only put lmac.o, ieee80211_misc.o, ets_time.o and wdev.o in iram0.
2017-02-17 10:24:54 +08:00
Ivan Grokhotkov
413f05ce09 Merge branch 'docs/flash_encryption_disable' into 'master'
Docs: Document flash encryption disable steps, clean up flash encryption & secure boot docs

Generate clean up of flash encryption & secure boot docs

Including steps for disabling flash encryption (for people who accidentally enable it).

See merge request !500
2017-02-15 13:31:08 +08:00
Angus Gratton
7c7edab328 flash encryption/secure boot: Restructure documentation
Also add steps to disable flash encryption, as some people seem to
accidentally enable it.

Explicitly mark the flash encryption and secure boot as "READ DOCS
FIRST" in menuconfig.
2017-02-15 09:42:46 +11:00
Angus Gratton
76d4f65ff9 bootloader: Add more flexible QIO support, for non-orthogonal command sets
Should allow enabling QIO mode on WinBond (not yet tested).
2017-02-09 08:44:05 +11:00
Angus Gratton
68cba2a1fb Bootloader: Support switching to Quad I/O mode during boot process 2017-02-09 08:44:05 +11:00
Angus Gratton
813395adcb OTA: Fall back to factory partition if ota data partition is invalid 2017-01-26 16:20:06 +11:00
Ivan Grokhotkov
8c26dd8d38 Merge branch 'feature/idf_version' into 'master'
build system: add IDF_VER environment variable and preprocessor define

This adds an `IDF_VER` preprocessor define which is obtained from `git describe`.

Looks like `v1.0-275-g0efaa4f` for non-release version or `v2.0` for a tagged (release) version.

See merge request !403
2017-01-11 11:34:28 +08:00
Ivan Grokhotkov
89e0ecc272 build system: add IDF_VER environment variable and preprocessor define 2017-01-11 00:24:50 +08:00
Ivan Grokhotkov
c1b06bf0a2 bootloader: export ets_update_cpu_frequency 2017-01-09 03:08:24 +08:00
Ivan Grokhotkov
339267ffc9 Merge branch 'feature/bootloader_rng' into 'master'
Enable bootloader entropy source for RNG

Enables an entropy source when bootloader starts up, which both seeds the RNG for use before WiFi/BT stack is enabled and provides an adequate RNG for secure boot & flash encryption key generation.

A prerequisite was enabling 80MHz operation, so the CPU is now set to 80MHz as soon as second stage bootloader starts running.

See merge request !363
2017-01-07 18:46:10 +08:00
Ivan Grokhotkov
0b264f4f7b bootloader: update ld script comment 2017-01-06 13:47:53 +08:00
Liu Zhi Fu
1b38494df4 bootloader: modify bootloader dram start address to 0x3fff0000
Modify bootloader dram_seg from address 0x3ffc0000 to 0x3fff0000, len from
0x20000 to 0x10000. Please be notified that this is just a workaround for
fixing app data overwrite bootloader data issue!
2017-01-06 13:44:09 +08:00
Angus Gratton
3922ce47b2 bootloader: Enable early boot RNG entropy source
This reverts commit ceb8566970.
2017-01-04 17:07:12 +11:00
Angus Gratton
83442526e0 bootloader: Allow custom baud rate on UART 0 2017-01-04 16:24:12 +11:00
Angus Gratton
2e3ca1c2f7 bootloader: Boost bootloader CPU to 80MHz
Partially needed to use RNG, also useful to improve boot performance.
2017-01-04 16:07:19 +11:00
Angus Gratton
76e61ded30 bootloader: Call esp_partition_table_basic_verify() as part of standard boot
Was previously only verified during flash encryption.
2016-12-30 14:19:46 +11:00
Angus Gratton
d245f016ea esptool: Add new options to reset before/after, detect flash size 2016-12-30 14:19:46 +11:00
Ivan Grokhotkov
05fcdcfedb Merge branch 'bugfix/make_erase_flash' into 'master'
build system: Fix bug where erase_flash was always invoked for flash

Order-only prerequisites do not work for phony targets!

See merge request !337
2016-12-25 09:13:58 +08:00
Angus Gratton
abb7668af7 build system: Fix bug where erase_flash was always invoked for flash
Order-only prerequisites do not work for phony targets!
2016-12-22 16:37:28 +11:00
Angus Gratton
4cfbe80b0f Merge branch 'bugfix/bootloader_stack' into 'master'
bootloader: Check if DRAM segments are going to collide with stack



See merge request !330
2016-12-22 12:15:18 +08:00
Ivan Grokhotkov
a760eb3980 Merge branch 'feature/erase_flash' into 'master'
Build system: Add `make erase_flash` target



See merge request !328
2016-12-22 09:53:25 +08:00
Angus Gratton
51cd654658 Merge branch 'bugfix/ota_select_info_point_fix' into 'master'
bootloader: fix error pointer to ota select info

bbs issue: http://www.esp32.com/viewtopic.php?f=14&t=615,
ota select info should be in different sector

See merge request !316
2016-12-21 06:54:21 +08:00
Angus Gratton
198889ad26 bootloader: Check if DRAM segments are going to collide with stack 2016-12-20 16:14:07 +11:00
Angus Gratton
59e0f63d37 Build system: Add make erase_flash target 2016-12-20 10:00:04 +11:00
Angus Gratton
d6fafd00db Secure boot: Option for app & partition table signing to happen outside build system 2016-12-19 13:12:05 +11:00
Tian Zhong Xing
461aab3e75 bootloader: fix error pointer to ota select info 2016-12-16 18:47:25 +08:00
Angus Gratton
bbe1bceda8 build system: Project ELF should depend on linker scripts, binary libraries
TW#7816
2016-12-12 15:58:53 +11:00
Angus Gratton
bab1d49f1f Merge branch 'feature/esptool_flash_encryption' into 'master'
Flash encryption support

Flash encryption support in build system, tooling

To come in future MR:
* On-device key generation on first boot (for production devices), need to finalise testing of bootloader entropy seeding.
* spi_flash_encrypted_write to support non-32-byte block writes (at least optionally.)
* I think a lot of the bootloader_support component can possibly be rolled into "spiflash" and other components, to use a common API.

See merge request !240
2016-12-12 06:50:46 +08:00
Ivan Grokhotkov
f504e23d0f bootloader, driver/rtc: fix warnings about unused functions 2016-12-09 15:47:32 +08:00
Ivan Grokhotkov
b3f6cd08db support for console redirection to other UART
This change adds a set of menuconfig options to set custom UART#, baud rate, and pins, for console output.
Setting happens in bootloader startup code for PRO CPU, and in application startup code for APP CPU.
Ref. TW8146
2016-12-08 01:42:37 +08:00
Angus Gratton
506c8cd964 secure boot & flash encryption: Rework configuration options
Add UART bootloader disable options for flash encryption
2016-12-01 23:49:12 -08:00
Angus Gratton
9eb135fd73 Flash encryption: Support enabling flash encryption in bootloader, app support
* App access functions are all flash encryption-aware
* Documentation for flash encryption
* Partition read/write is flash aware
* New encrypted write function
2016-12-01 23:49:12 -08:00
tzx
2092d14e45 app_update: fix inconsistency between bootloader and OTA code 2016-12-01 13:46:02 +08:00
antti
d390449371 add unit tests to esp-idf
rename nvs host test folder, modify .gitlab-ci.yml

remove unit-test-app build

re-format unit test files

remove extra newlines in project.mk

some refactoring for unit test part in project.mk

add build files of unit-test-app in gitignore

add README.md for unit test app

correct headings in README.md

remove files and make minor tweaks in unit test app

update .gitlab-ci.yml to use unit test app

delete unused lines in component_wrapper.mk

delete periph_i2s.h and lcd test

add text floating point in components/esp32/test/Kconfig

correct idf test build paths in .gitlab-ci.yml
2016-11-22 14:45:50 +08:00
Angus Gratton
c15024e629 Merge branch 'master' into feature/build_component_project_vars 2016-11-14 14:54:41 +11:00
Angus Gratton
ea4005e673 Merge branch 'feature/esptool_secure_boot' into 'master'
Secure boot support

Also includes a lot of esptool.py changes (two new command line tools, espefuse.py and espsecure.py)
https://github.com/themadinventor/esptool/compare/feature/esp32_v20_refactor...feature/esp32_secure_boot?expand=1


See merge request !163
2016-11-14 11:32:04 +08:00
Angus Gratton
09c7ccfa2c bootloader: Fix unused variable errors when secure boot is disabled 2016-11-14 14:22:37 +11:00
Angus Gratton
0b4fe9dd6d secure boot: Add warnings this feature is not finished yet 2016-11-14 14:22:36 +11:00
Angus Gratton
8691b54758 secure boot: Rename efuse option for UART bootloader to option for ROM interpreter 2016-11-14 11:08:42 +11:00
Angus Gratton
bcdebda8e4 Build system: Don't shell-quote SEPARATOR variable or it evaluates as a bunch of wildcards! 2016-11-14 11:08:42 +11:00
Angus Gratton
e459f803da secure boot: Functional partition table & app signature verification 2016-11-14 11:08:42 +11:00
Angus Gratton
fe66dd85f0 secure boot: Enable based on sdkconfig, remove "secure boot flag" from binary image 2016-11-14 11:08:42 +11:00
Angus Gratton
64f3893cb9 secure boot: Derive secure bootloader key from private key
Means only one key needs to be managed.
2016-11-14 11:08:42 +11:00
Angus Gratton
b5de581399 Secure boot: initial image signature support 2016-11-14 11:08:42 +11:00
Angus Gratton
341593f7d2 build system: Remove need for $(Q) macro in recipes, use --silent in MAKEFLAGS instead 2016-11-11 12:32:47 +11:00
Angus Gratton
208e83def7 build system: Refactor component.mk to not need component_common.mk
New makefile component_wrapper.mk allows some variables to be set
before component.mk is evaluated. This properly fixes problems with
sdkconfig being hard to access in all phases of the build.

Including component_common.mk is no longer necessary and will print a
deprecation warning for components which use it.
2016-11-10 15:52:22 +11:00
Angus Gratton
155f912433 build system: Don't build an sdkconfig for bootloader, share the top-level one
This works because all CONFIG variables are exported into child make processes.
2016-11-09 16:51:52 +11:00
Angus Gratton
830e5caf4d build system: Replace get_variable target w/ component_project_vars.mk generated makefiles
Reduces number of make invocations, allows variables exported in project
to be seen in all component make processes, not just the main ones.

Also makes a no-op build about 3x faster than it was.
2016-11-09 16:51:52 +11:00
Angus Gratton
c5793521a0 build system: Fix bootloader-flash target
ESP32 forum thread: http://esp32.com/viewtopic.php?f=2&t=407&p=1902#p1902
2016-11-08 20:17:08 +08:00
Angus Gratton
98a0387854 bootloader_support: Move secure boot code to bootloader_support 2016-11-08 11:13:54 +11:00
Ivan Grokhotkov
2fa00ebd90 ld scripts: fix overlap between bootloader and application IRAM ranges 2016-11-04 12:18:57 +08:00
Angus Gratton
aceb6517c0 Refactor existing bootloader common functionality into bootloader_support component 2016-11-02 17:58:41 +11:00
Angus Gratton
04beb8baba Add documentation for bootloader secure boot stage 2016-11-02 10:41:59 +11:00
Angus Gratton
4ba1b73eba build system: Add espefuse/espsecure support for secure boot 2016-11-02 10:41:59 +11:00
Angus Gratton
f10cc7dc8e bootloader: Refactor secure boot digest generation 2016-11-02 10:41:59 +11:00
Ivan Grokhotkov
628bde2080 bootloader: move useful structures to esp32 component 2016-10-27 17:57:29 +08:00
Angus Gratton
1413ec3ff0 Remove SPIUnlock from linker script symbols
Add a comment about why it was removed and where it went.
2016-10-21 17:50:37 +11:00
Angus Gratton
f37e70ebd6 Bootloader: Export IS_BOOTLOADER_BUILD during make process 2016-10-21 17:50:37 +11:00
Ivan Grokhotkov
42827ff869 bootloader, menuconfig: add flash size setting support 2016-10-21 15:27:25 +11:00
Angus Gratton
90cad92b9b Merge branch 'master' into bugfix/build_dir_base 2016-10-18 15:30:57 +11:00
Angus Gratton
c12582c122 bootloader: Fix accidental tabs introduced in !78 2016-10-11 07:56:08 +11:00
Angus Gratton
305bc9fd9c build system: Run parallel builds without warnings
Ref github #38
2016-10-06 18:29:34 +11:00
Angus Gratton
f720e82d40 build system: Allow BUILD_DIR_BASE to be a relative directory (see github #38) 2016-10-06 18:05:51 +11:00
Angus Gratton
477d71e589 config system: Fix configuration when BUILD_DIR_BASE out-of-tree
Ref #38. Also no longer generates bootloader sdkconfig in source tree.
2016-10-04 15:38:20 +11:00
Angus Gratton
66882347e8 build system: Fix out-of-tree building via BUILD_DIR_BASE
Closes #38
2016-10-04 15:04:56 +11:00
Angus Gratton
7c494055e3 esp32: Bootloader wake deep sleep stub
App can contain a stub program resident in RTC fast memory. Bootloader
will load the stub on initial boot. If the device wakes from deep sleep,
the stub is run immediately (before any other data is loaded, etc.)

To implement a custom wake stub, implement a function in your program:

```
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
  esp_default_wake_deep_sleep();
  // other wake logic
}
```

... and it will replace the default implementation.
2016-09-28 11:14:58 +08:00