From 68e0a805615d2f72ff9e2edcc0313d82f9450651 Mon Sep 17 00:00:00 2001 From: Chen Wu Date: Fri, 4 Jan 2019 14:13:25 +0800 Subject: [PATCH] feat: add user data to bin header user could put some data into bin header by USER_DATA_ATTR attribute, defined in esp_attr.h --- components/esp8266/include/esp_attr.h | 3 +++ components/esp8266/ld/esp8266.common.ld | 1 + 2 files changed, 4 insertions(+) diff --git a/components/esp8266/include/esp_attr.h b/components/esp8266/include/esp_attr.h index 61d73236..5beb0327 100644 --- a/components/esp8266/include/esp_attr.h +++ b/components/esp8266/include/esp_attr.h @@ -46,4 +46,7 @@ // Forces read-only data into RTC memory. #define RTC_RODATA_ATTR __attribute__((section(".rtc.rodata"))) +// Forces to put some user defined data in the binary file header, the offset is 0x10. +#define USER_DATA_ATTR __attribute__((section(".user.data"))) + #endif /* __ESP_ATTR_H__ */ diff --git a/components/esp8266/ld/esp8266.common.ld b/components/esp8266/ld/esp8266.common.ld index f35ca08a..c8c3e5c1 100644 --- a/components/esp8266/ld/esp8266.common.ld +++ b/components/esp8266/ld/esp8266.common.ld @@ -230,6 +230,7 @@ SECTIONS .irom0.text : ALIGN(4) { _irom0_text_start = ABSOLUTE(.); + *(.user.data) *(.rodata.* .rodata .irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) *(.literal.* .text.*)