1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/esp8266/Makefile.include
iosabi 7b1f083cd8 esp8266: Download Espressif RTOS SDK as a new RIOT PKG
RIOT-OS uses part of Espressif ESP8266 RTOS SDK to build support for
this CPU. The SDK includes some vendor-provided closed source
pre-compiled libraries that we need to modify to adapt to RIOT-OS
usage. This library modifications was done once and uploaded to a fork
of the vendor repository and was provided as an environment variable.

This patch changes two things:

1. It installs the SDK as a RIOT PKG from the new pkg/esp8266_sdk
directory instead of requiring the user to download it separately.

2. It performs the library modifications (symbol renames) on the pkg
Makefile removing the need to use a fork with the modifications applied
and simplifying the SDK update and future modifications.

This change sets the SDK package version (git SHA) to the same one that
our fork was using as a parent in the vendor repository, meaning that
the output libraries are exactly the same as before.

Tested with
```
ESP8266_RTOS_SDK_DIR=/dev/null USEMODULE=esp_log_startup make -C tests/shell BOARD=esp8266-esp-12x flash
```

and verified that the program works. The boot message now includes:
```
ESP8266-RTOS-SDK Version v3.1-51-g913a06a9
```
confirming the SDK version used.

`/dev/null` in the test is just to make sure that no evaluation of
`ESP8266_RTOS_SDK_DIR` in make is affected by the environment variable
value which would be set to the SDK for people who followed the set up
instructions before this change.

Tested the checkout size:
```bash
$ du -hs build/pkg/esp8266_sdk/
124M	build/pkg/esp8266_sdk/
```
2021-10-23 11:13:38 +00:00

54 lines
1.7 KiB
Makefile

# With the '-Os' option, char arrays have not to be 32-bit word aligned. This
# leads to an alignment exception when the address of a char array is assigned
# to an 'uint32_t' pointer and the pointer is used for the access.
CFLAGS_OPT ?= -O2
# ESP8266 specific flashing options
FLASH_CHIP = esp8266
FLASH_OPTS = --version 3
FLASH_MODE = dout # DO NOT CHANGE, ESP8266/ESP8285 modules only work with dout
FLASH_FREQ = 26m # DO NOT CHANGE
FLASH_SIZE ?= 1
BOOTLOADER_POS = 0x0000
include $(RIOTCPU)/esp_common/Makefile.include
# regular Makefile
TARGET_ARCH_ESP8266 ?= xtensa-esp8266-elf
TARGET_ARCH ?= $(TARGET_ARCH_ESP8266)
PSEUDOMODULES += esp_sw_timer
INCLUDES += -I$(RIOTCPU)/$(CPU)
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/bootloader_support/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/esp8266/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/esp8266/include/esp8266
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/heap/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/log/include
CFLAGS += -D__ESP_FILE__=__FILE__
ifneq (,$(filter esp_gdbstub,$(USEMODULE)))
GDBSTUB_DIR ?= $(RIOTCPU)/$(CPU)/vendor/esp-gdbstub
CFLAGS += -DGDBSTUB_BREAK_ON_INIT=1
INCLUDES += -I$(GDBSTUB_DIR)
endif
ifneq (,$(filter esp_now,$(USEMODULE)))
ARCHIVES += -lespnow
endif
ARCHIVES += -lgcc -lwpa -lcore -lnet80211 -lphy -lpp -lstdc++
LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ld
LINKFLAGS += -Tesp8266.rom.ld
LINKFLAGS += -Tesp8266.riot-os.ld
LINKFLAGS += -Tesp8266.peripherals.ld
LINKFLAGS += -Wl,-wrap=pp_attach
LINKFLAGS += -Wl,-wrap=pm_attach