Commit graph

201 commits

Author SHA1 Message Date
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
Ivan Grokhotkov dcf34b1be1 bootloader: remove trailing newlines from log messages 2016-09-20 14:18:23 +08:00
Ivan Grokhotkov 69278b28bf components/log: fix bugs, add options to override log level for files, components, and bootloader 2016-09-18 20:24:31 +08:00
Ivan Grokhotkov b0683b0bb4 components/esp32,bootloader: fix build
esp32: use new register name in cpu_start
bootloader: EXTRA_CFLAGS don't work any more, set global CFLAGS in Makefile.projbuild
2016-09-15 02:37:54 +08:00
Ivan Grokhotkov cf22e4445a Merge branch 'master' into feature/logging
* master: (45 commits)
  esp32/lib: update to 1303c92c
  dhcpserver: Fix crash when switching wifi mode
  mbedtls: Temporarily disable default hardware crypto SHA & bignum
  mbedtls hwcrypto sha512: Fix redirection of function names
  mbedtls upstream tweak: Move mbedtls_sha512_process in sha512.h
  Format code by using 4 spaces instead
  modify  character conversion error and typo
  modify i2s_reg.h, rebase to master
  Only modify headers in soc/ . Pass compiling under esp-idf-tests/merge_soc_tmp/merge_for_soc_headers branch.(only change some names of register and INUM).
  Rename vender_ie_type_t and vendor_ie_id_t to wifi_vendor_ie_type_t and wifi_vendor_ie_id_t respectively
  modify arguments for vendor ie APIs by using enum instead
  esp32: fix typo
  esp32: fix kconfig
  define lwip task priority in esp_task.h
  components: esp32 - fix build error
  components: lwip - Modify lwip task priority and stack definition method
  components: esp32
  components: esp32
  components: esp32/lwip
  task priority: modify lwip/wifi/event task priority
  ...

# Conflicts:
#	components/bootloader/src/main/bootloader_start.c
#	components/bootloader/src/main/flash_encrypt.c
#	components/bootloader/src/main/secure_boot.c
#	components/esp32/cpu_start.c
2016-09-15 02:15:50 +08:00
Ivan Grokhotkov 0290a34b55 components/esp32: clean up cpu_start
Move CPU region protection setup into soc/cpu.h
change tabs to spaces
remove unused extern declarations
use RTC_WDTCONFIG0 instead of numeric address (still need to fix BB reg)
2016-09-15 02:03:55 +08:00
Ivan Grokhotkov 716cec5ded components/log: add implementation, update a few components to use it
This also removes logging implementation from bootloader and replaces it
with the one provided by the log component. Some occurrences of printf
and ets_printf have been changed to ESP_LOGx APIs.
2016-09-15 00:53:33 +08:00
Wu Jian Gang 2efaf42253 Merge remote-tracking branch 'origin/feature/mbedtls' 2016-09-14 18:05:56 +08:00
Wangjialin 41d397cf3f Only modify headers in soc/ .
Pass compiling under esp-idf-tests/merge_soc_tmp/merge_for_soc_headers branch.(only change some names of register and INUM).
2016-09-14 13:47:28 +08:00
Wu Jian Gang b56098a612 Merge remote-tracking branch 'origin/master' into feature/mbedtls 2016-09-13 16:31:48 +08:00
Angus Gratton 3061ae40c0 bootloader: Add bootloader Kconfig
Allow debug level & colour highlighting to be configured
2016-09-13 14:18:17 +10:00
jack 24011ddd05 header files: modify rom code and soc header files
1. timer reg file for both time group 0 and time group 1, not only timer group 0
2. fix bug that io mux header file mismatch with chip
3. fix bug that some BASE address not correct
4. add some static function to eagle.fpga32.rom.addr.v7.ld
5. add interrupts usage table
6. add some comments for rom code functions
2016-09-12 17:47:49 +08:00
Angus Gratton 7c58c1e06b Build system: Allow components to add to the global CFLAGS via Makefile.projbuild
Used by mbedTLS to set MBEDTLS_CONFIG_FILE in all components.

This change sets CFLAGS/etc at the project level and then exports those
variables for components, rather than setting them independently each time
a component Makefile is invoked.
2016-09-09 11:08:19 +10:00
Angus Gratton 3b1c3dab4b Name component makefiles component.mk instead of Makefile
Fixes problems with Eclipse trying to build in directories it shouldn't.

This is a breaking change for existing repositories, they need to rename
any component Makefiles to component.mk and rename their references to
$(IDF_PATH)/make/component.mk to $(IDF_PATH)/make/component_common.mk
2016-09-08 13:41:19 +10:00
Wu Jian Gang f4b3820ecd Merge branch 'feature/ld_change' into 'master'
update ld and heap region

Divide origin fpga ld to several lds,  choose specific ld for normal/BT/Trace by menuconfig, change iram/dram len in ld to full use hardware ram region.

See merge request !28
2016-08-25 15:52:11 +08:00
Wu Jian Gang c72248193b ld: fix ld for bootloader 2016-08-25 11:35:06 +08:00
Ivan Grokhotkov 842bc53549 Merge branch 'bugfix/dualcore_startup' into 'master'
Fix dualcore startup

This MR includes:
- a workaround for a hardware bug with cache initialization
- fix of `#if CONFIG_WIFI_ENABLED` block in cpu_start.c for the case when WiFi is disabled.
- removal of miscellaneous delays in cpu_start.c

See merge request !22
2016-08-25 11:07:21 +08:00
Ivan Grokhotkov 4d1084120c components/bootloader: fix enabling cache for APP CPU
This is a workaround for a hardware bug with cache initialization.
Only two lines of code related to DPORT_APP_CACHE_MMU_IA_CLR were added around mmu_init(1); call,
and two lines at the end of comment block.
I reformatted surrounding lines to use spaces for indentation, like the rest of the code in this file does.
2016-08-24 16:25:04 +08:00
Angus Gratton a278c51d3e Make: Building the bootloader depends on syncing its sdkconfig from the top-level project 2016-08-24 13:25:06 +08:00
Angus Gratton 1fd22c5748 make bootloader: Always recurse into bootloader directory to check source dependencies 2016-08-24 13:25:06 +08:00
Angus Gratton aa4c31f3b0 esptool.py & Makefile: Fix compressed upload support (enabled by default) 2016-08-22 18:44:46 +08:00
Angus Gratton f853f94335 Use IDF_PATH instead of SDK_PATH for the environment variable pointing to esp-idf
This will require a matching change in all projects using ESP-IDF.
2016-08-19 15:01:49 +08:00
Angus Gratton 9ec0e1545d Standardise remaining uses of SDK to ESP-IDF 2016-08-19 15:01:15 +08:00
Angus Gratton b0f530d004 Makefile: bootloader-clean shouldn't clean config or partition table
Also don't build config for 'make help', and remove some redundant
clearing of variables.
2016-08-19 14:04:51 +08:00
Angus Gratton 14eb490bb3 make: 'make all' default target builds everything, 'make flash' flashes everything
Also added 'make help' target which prints some useful usage summary.
2016-08-18 21:42:37 +08:00
Angus Gratton 9552b0e6f0 Fix 'make bootloader' not printing instructions 2016-08-18 21:42:37 +08:00
Angus Gratton 45d1baa24b Make: Fix make bootloader, make bootloader-flash, cleaning of bootloader
Should resolve TW6610
2016-08-18 21:15:47 +08:00
Ivan Grokhotkov bd6ea4393c Initial public version 2016-08-17 23:08:22 +08:00