espressif / ESP8266_NONOS_SDK

ESP8266 nonOS SDK
Other
929 stars 535 forks source link

How to use rBoot with v3.0 ? #163

Closed fvpalha closed 6 years ago

fvpalha commented 6 years ago

Hi.

How I can to configure the partition table in FOTA with rBoot (https://github.com/raburton/rboot) ?

I thinked:

if ((SPI_FLASH_SIZE_MAP == 0) || (SPI_FLASH_SIZE_MAP == 1))

error "The flash map is not supported"

elif (SPI_FLASH_SIZE_MAP == 2)

define SYSTEM_PARTITION_OTA_SIZE 0x6A000

define SYSTEM_PARTITION_OTA_1_ADDR 0x02000

define SYSTEM_PARTITION_OTA_2_ADDR 0x82000

define SYSTEM_PARTITION_RF_CAL_ADDR 0xfb000

define SYSTEM_PARTITION_PHY_DATA_ADDR 0xfc000

define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0xfd000

elif (SPI_FLASH_SIZE_MAP == 3)

define SYSTEM_PARTITION_OTA_SIZE 0x6A000

define SYSTEM_PARTITION_OTA_1_ADDR 0x02000

define SYSTEM_PARTITION_OTA_2_ADDR 0x82000

define SYSTEM_PARTITION_RF_CAL_ADDR 0x1fb000

define SYSTEM_PARTITION_PHY_DATA_ADDR 0x1fc000

define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x1fd000

elif (SPI_FLASH_SIZE_MAP == 4)

define SYSTEM_PARTITION_OTA_SIZE 0x6A000

define SYSTEM_PARTITION_OTA_1_ADDR 0x02000

define SYSTEM_PARTITION_OTA_2_ADDR 0x82000

define SYSTEM_PARTITION_RF_CAL_ADDR 0x3fb000

define SYSTEM_PARTITION_PHY_DATA_ADDR 0x3fc000

define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x3fd000

elif (SPI_FLASH_SIZE_MAP == 5)

define SYSTEM_PARTITION_OTA_SIZE 0x6A000

define SYSTEM_PARTITION_OTA_1_ADDR 0x02000

define SYSTEM_PARTITION_OTA_2_ADDR 0x102000

define SYSTEM_PARTITION_RF_CAL_ADDR 0x1fb000

define SYSTEM_PARTITION_PHY_DATA_ADDR 0x1fc000

define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x1fd000

elif (SPI_FLASH_SIZE_MAP == 6)

define SYSTEM_PARTITION_OTA_SIZE 0x6A000

define SYSTEM_PARTITION_OTA_1_ADDR 0x02000

define SYSTEM_PARTITION_OTA_2_ADDR 0x102000

define SYSTEM_PARTITION_RF_CAL_ADDR 0x3fb000

define SYSTEM_PARTITION_PHY_DATA_ADDR 0x3fc000

define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x3fd000

else

error "The flash map is not supported"

endif

@raburton, do you have a tip?

Thank you.

xcguang commented 6 years ago

Hi, Maybe https://github.com/espressif/ESP8266_NONOS_SDK/blob/release/v3.0.0/documents/EN/%20Partition%20Table.md can help you.

fvpalha commented 6 years ago

Hi @xcguang

My doubt is about the "MUST", in rBoot the addresses are 0x2000 and 0x82000 or 0x102000.

user1.bin MUST be at address 0x1000. user2.bin: For 512+512 map, MUST be at address 0x81000. For 1024+1024 map, MUST be at address 0x101000.

xcguang commented 6 years ago

Hi @fvpalha , I guess the following code would work well for rBoot, but I'm not sure. Next Monday I will try rBoot,if it doesn't work, we will provide a solution. Sorry for the inconvenience.

#define RBOOT_OTA1              (SYSTEM_PARTITION_CUSTOMER_BEGIN + 1)
#define RBOOT_OTA2              (SYSTEM_PARTITION_CUSTOMER_BEGIN + 2)

static const partition_item_t partition_table[] = {
    { SYSTEM_PARTITION_BOOTLOADER,  0x0000, 0x2000},
    { RBOOT_OTA1,   0x2000, 0x60000},
    { RBOOT_OTA2, 0x82000, 0x60000},
    { SYSTEM_PARTITION_RF_CAL, SYSTEM_PARTITION_RF_CAL_ADDR, 0x1000},
    { SYSTEM_PARTITION_PHY_DATA, SYSTEM_PARTITION_PHY_DATA_ADDR, 0x1000},
    { SYSTEM_PARTITION_SYSTEM_PARAMETER,SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR, 0x3000},
};

void ICACHE_FLASH_ATTR user_pre_init(void)
{
    if(!system_partition_table_regist(partition_table, sizeof(partition_table)/sizeof(partition_table[0]),SPI_FLASH_SIZE_MAP)) {
        os_printf("system_partition_table_regist fail\r\n");
        while(1);
    }
}
fvpalha commented 6 years ago

Thank you @xcguang

I go to wait the end solution.

Congratulation by the SDK.

ustccw commented 6 years ago

@fvpalha would you mind providing the bin file of rboot for us to test it.

ustccw commented 6 years ago

@fvpalha if rboot works well with sdk which not including partition table. the following partition table also can work.

#define RBOOT_OTA1              (SYSTEM_PARTITION_CUSTOMER_BEGIN + 1)
#define RBOOT_OTA2              (SYSTEM_PARTITION_CUSTOMER_BEGIN + 2)

static const partition_item_t partition_table[] = {
    { SYSTEM_PARTITION_BOOTLOADER,  0x0000, 0x2000},
    { RBOOT_OTA1,   0x2000, 0x60000},
    { RBOOT_OTA2, 0x82000, 0x60000},
    { SYSTEM_PARTITION_RF_CAL, SYSTEM_PARTITION_RF_CAL_ADDR, 0x1000},
    { SYSTEM_PARTITION_PHY_DATA, SYSTEM_PARTITION_PHY_DATA_ADDR, 0x1000},
    { SYSTEM_PARTITION_SYSTEM_PARAMETER,SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR, 0x3000},
};

void ICACHE_FLASH_ATTR user_pre_init(void)
{
    if(!system_partition_table_regist(partition_table, sizeof(partition_table)/sizeof(partition_table[0]),SPI_FLASH_SIZE_MAP)) {
        os_printf("system_partition_table_regist fail\r\n");
        while(1);
    }
}
fvpalha commented 6 years ago

@ustccw the binary can be founded in https://github.com/fvpalha/rboot

ustccw commented 6 years ago

@fvpalha hi, rboot cannot work, error always happened like the following, could you give me some advice: _003

fvpalha commented 6 years ago

Hi @ustccw . I will wait the @raburton solution. At moment, I use NON-OS SDK v2.2.1

someburner commented 6 years ago

I have not tried yet, but if this is true, this represents a breaking change in the SDK. At least give us the option of not using the partition table. The math is really not that hard to figure out and many, many projects have been happily using rBoot for years now.

xcguang commented 6 years ago

Hi @fvpalha , It seems that "user code done" is magic error. The latest sdk bin magic is 0xEA. Could you help compile a rBoot.bin? I always fail to compile it because I have no esptool2.

fvpalha commented 6 years ago

Hi @xcguang ,

Right, I will try again with your suggestion.

Thank you.

eriksl commented 6 years ago

I think (famous last words...) that it is going to work if you don't mention OTA at all. Don't use the SDK OTA partitions, use "user defined" partitions there. Rboot OTA is not the same as SDK OTA.

I will report.

eriksl commented 6 years ago

It works :-)

The only hoop I had to jump through was that my flash is 16 Mb, 1024/1024 and rboot (in fact esptool2) doesn't understand that layout. For 16 Mb it will select 16 Mb, 512/512 which is code 3, while I am using 1024/1024 which is code 5. This is a mismatch according to the SDK and it refuses to but. I patched up rboot and esptool2 and now it works.

stat_debug_1 = 1, so the function gets called stat_debug_2 = 1, so the regist function returns OK it does complain over missing boot and ota partitions though, on the UART but apparently it can live with it.

static const partition_item_t partition_items[] =
{
    {   SYSTEM_PARTITION_RF_CAL,                RFCAL_OFFSET,               RFCAL_SIZE,             },
    {   SYSTEM_PARTITION_PHY_DATA,              PHYDATA_OFFSET,             PHYDATA_SIZE,           },  
    {   SYSTEM_PARTITION_SYSTEM_PARAMETER,      SYSTEM_CONFIG_OFFSET,       SYSTEM_CONFIG_SIZE,     },  
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 0,    USER_CONFIG_OFFSET,         USER_CONFIG_SIZE,       },
#if IMAGE_OTA == 0
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 1,    OFFSET_IRAM_PLAIN,          SIZE_IRAM_PLAIN,        },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 2,    OFFSET_IROM_PLAIN,          SIZE_IROM_PLAIN,        }
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 3,    SEQUENCER_FLASH_OFFSET,     SEQUENCER_FLASH_SIZE,   },
#else
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 1,    OFFSET_OTA_BOOT,            SIZE_OTA_BOOT,          },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 2,    OFFSET_OTA_RBOOT_CFG,       SIZE_OTA_RBOOT_CFG,     },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 3,    OFFSET_OTA_IMG_0,           SIZE_OTA_IMG,           },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 4,    OFFSET_OTA_IMG_1,           SIZE_OTA_IMG,           },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 5,    SEQUENCER_FLASH_OFFSET_0,   SEQUENCER_FLASH_SIZE,   },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 6,    SEQUENCER_FLASH_OFFSET_1,   SEQUENCER_FLASH_SIZE,   },
#endif
};

void user_pre_init(void);
iram void user_pre_init(void)
{
    stat_debug_1 = 1;
    stat_debug_2 = system_partition_table_regist(partition_items, sizeof(partition_items) / sizeof(*partition_items), FLASH_SIZE_16M_MAP_1024_1024);
}
someburner commented 6 years ago

@eriksl - that is good news, thanks for looking into it!

@xcguang

it does complain over missing boot and ota partitions though

It would be nice to know if this is indeed just a warning, or is it possible this will result in some sort of instability or crash?

xcguang commented 6 years ago

Hi @someburner , It's just a warning. SYSTEM_PARTITION_RF_CAL,SYSTEM_PARTITION_PHY_DATA and SYSTEM_PARTITION_SYSTEM_PARAMETER is necessary. Others are optional, but you must ensure it works well.

xcguang commented 6 years ago

How about the issue? Is it resolved?

eriksl commented 6 years ago

Yes, there is no issue.

The original poster did not realise that rboot is a "normal" application as the SDK is concerned. Once rboot is started, it will take care of loading the further images. So everyone using rboot should NOT mark the image slots as "OTA" but as "USER" partitions and then it works.

E.g. like this

static const partition_item_t partition_items[] =
{
    {   SYSTEM_PARTITION_RF_CAL,                RFCAL_OFFSET,               RFCAL_SIZE,             },
    {   SYSTEM_PARTITION_PHY_DATA,              PHYDATA_OFFSET,             PHYDATA_SIZE,           },
    {   SYSTEM_PARTITION_SYSTEM_PARAMETER,      SYSTEM_CONFIG_OFFSET,       SYSTEM_CONFIG_SIZE,     },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 0,    USER_CONFIG_OFFSET,         USER_CONFIG_SIZE,       },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 1,    OFFSET_OTA_BOOT,            SIZE_OTA_BOOT,          },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 2,    OFFSET_OTA_RBOOT_CFG,       SIZE_OTA_RBOOT_CFG,     },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 3,    OFFSET_OTA_IMG_0,           SIZE_OTA_IMG,           },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 4,    OFFSET_OTA_IMG_1,           SIZE_OTA_IMG,           },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 5,    SEQUENCER_FLASH_OFFSET_0,   SEQUENCER_FLASH_SIZE,   },
    {   SYSTEM_PARTITION_CUSTOMER_BEGIN + 6,    SEQUENCER_FLASH_OFFSET_1,   SEQUENCER_FLASH_SIZE,   },
};
xcguang commented 6 years ago

Hi All, I will close this issue, if you have any question, please create a new issue, thanks.

scargill commented 6 years ago

Hi

I use RBOOT.

I copied the partition info from the comment above - and the user pre-init from 3 comments up - and I put the lot into my user_main.c page. I changed from SDK 2.2 to SDK 3.1

and thie result won't compile. I tried adding integer definitions for stat_debug_1 and stat_debug_2 - still a boatl;oad of errors.

My code, with RBOOT works a TREAT with SDK 2.1 and previous... what am I missing?

Errors include "RFCAL_OFFSET undeclared here" and similar - indeed nothing in that table appears to be declared...

and also

user/user_main.c:153:6: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void'

I just did a copy and paste from above so I've not introduced errors.

Regards

Pete

scargill commented 6 years ago

As to the solution proposed by ERIKDL - I can't even SAVE that, even with NOTEPAD++ on my PC - as strange characters get introduced into the file which I can't seem to remove...

eriksl commented 6 years ago

I never said you could 1-to-1 copy and paste this code. For a start it contains references to debugging variables that are declared elsewhere, the stat* variables. Just remove them.

Furthermore, I think your editor expects the dreadful MS/Windows line ends, consisting of both line feed AND carriage return. This is not common practice in the open source world, where Unix style line ends are used -- just the line feed is enough.

As far as I know there are no non-ASCII characters, it would be weird to have them in a C program without user interface. So maybe github added them in their user interface. They're most likely UTF-8 and not a Windows codepage...

scargill commented 6 years ago

Hi Erik

Right..

This with debug vars removed...

`static const partition_item_t partition_items[] = { { SYSTEM_PARTITION_RF_CAL, RFCAL_OFFSET, RFCAL_SIZE, }, { SYSTEM_PARTITION_PHY_DATA, PHYDATA_OFFSET, PHYDATA_SIZE, }, { SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_CONFIG_OFFSET, SYSTEM_CONFIG_SIZE, }, { SYSTEM_PARTITION_CUSTOMER_BEGIN + 0, USER_CONFIG_OFFSET, USER_CONFIG_SIZE, }, { SYSTEM_PARTITION_CUSTOMER_BEGIN + 1, OFFSET_OTA_BOOT, SIZE_OTA_BOOT, }, { SYSTEM_PARTITION_CUSTOMER_BEGIN + 2, OFFSET_OTA_RBOOT_CFG, SIZE_OTA_RBOOT_CFG, }, { SYSTEM_PARTITION_CUSTOMER_BEGIN + 3, OFFSET_OTA_IMG_0, SIZE_OTA_IMG, }, { SYSTEM_PARTITION_CUSTOMER_BEGIN + 4, OFFSET_OTA_IMG_1, SIZE_OTA_IMG, }, { SYSTEM_PARTITION_CUSTOMER_BEGIN + 5, SEQUENCER_FLASH_OFFSET_0, SEQUENCER_FLASH_SIZE, }, { SYSTEM_PARTITION_CUSTOMER_BEGIN + 6, SEQUENCER_FLASH_OFFSET_1, SEQUENCER_FLASH_SIZE, }, };

void user_pre_init(void); iram void user_pre_init(void) { system_partition_table_regist(partition_items, sizeof(partition_items) / sizeof(*partition_items), FLASH_SIZE_16M_MAP_1024_1024); } That fails as everything is undeclared.... then at the end.. user/user_main.c:151:6: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void'`

This one has samew issues after sorting the Linux Line endings (my fault)

`static const partition_item_t partition_items[] = { { SYSTEM_PARTITION_RF_CAL, RFCAL_OFFSET, RFCAL_SIZE, }, { SYSTEM_PARTITION_PHY_DATA, PHYDATA_OFFSET, PHYDATA_SIZE, },
{ SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_CONFIG_OFFSET, SYSTEM_CONFIG_SIZE, },
{ SYSTEM_PARTITION_CUSTOMER_BEGIN + 0, USER_CONFIG_OFFSET, USER_CONFIG_SIZE, },

if IMAGE_OTA == 0

{   SYSTEM_PARTITION_CUSTOMER_BEGIN + 1,    OFFSET_IRAM_PLAIN,          SIZE_IRAM_PLAIN,        },
{   SYSTEM_PARTITION_CUSTOMER_BEGIN + 2,    OFFSET_IROM_PLAIN,          SIZE_IROM_PLAIN,        }
{   SYSTEM_PARTITION_CUSTOMER_BEGIN + 3,    SEQUENCER_FLASH_OFFSET,     SEQUENCER_FLASH_SIZE,   },

else

{   SYSTEM_PARTITION_CUSTOMER_BEGIN + 1,    OFFSET_OTA_BOOT,            SIZE_OTA_BOOT,          },
{   SYSTEM_PARTITION_CUSTOMER_BEGIN + 2,    OFFSET_OTA_RBOOT_CFG,       SIZE_OTA_RBOOT_CFG,     },
{   SYSTEM_PARTITION_CUSTOMER_BEGIN + 3,    OFFSET_OTA_IMG_0,           SIZE_OTA_IMG,           },
{   SYSTEM_PARTITION_CUSTOMER_BEGIN + 4,    OFFSET_OTA_IMG_1,           SIZE_OTA_IMG,           },
{   SYSTEM_PARTITION_CUSTOMER_BEGIN + 5,    SEQUENCER_FLASH_OFFSET_0,   SEQUENCER_FLASH_SIZE,   },
{   SYSTEM_PARTITION_CUSTOMER_BEGIN + 6,    SEQUENCER_FLASH_OFFSET_1,   SEQUENCER_FLASH_SIZE,   },

endif

}; ` Here is the output

CC user/user_main.c user/user_main.c:140:33: error: 'RFCAL_OFFSET' undeclared here (not in a function) { SYSTEM_PARTITION_RF_CAL, RFCAL_OFFSET, RFCAL_SIZE, }, ^ user/user_main.c:140:50: error: 'RFCAL_SIZE' undeclared here (not in a function) { SYSTEM_PARTITION_RF_CAL, RFCAL_OFFSET, RFCAL_SIZE, }, ^ user/user_main.c:141:34: error: 'PHYDATA_OFFSET' undeclared here (not in a function) { SYSTEM_PARTITION_PHY_DATA, PHYDATA_OFFSET, PHYDATA_SIZE, }, ^ user/user_main.c:141:53: error: 'PHYDATA_SIZE' undeclared here (not in a function) { SYSTEM_PARTITION_PHY_DATA, PHYDATA_OFFSET, PHYDATA_SIZE, }, ^ user/user_main.c:142:40: error: 'SYSTEM_CONFIG_OFFSET' undeclared here (not in a function) { SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_CONFIG_OFFSET, SYSTEM_CONFIG_SIZE, }, ^ user/user_main.c:142:63: error: 'SYSTEM_CONFIG_SIZE' undeclared here (not in a function) { SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_CONFIG_OFFSET, SYSTEM_CONFIG_SIZE, }, ^ user/user_main.c:143:41: error: 'USER_CONFIG_OFFSET' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 0, USER_CONFIG_OFFSET, USER_CONFIG_SIZE, }, ^ user/user_main.c:143:63: error: 'USER_CONFIG_SIZE' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 0, USER_CONFIG_OFFSET, USER_CONFIG_SIZE, }, ^ user/user_main.c:144:41: error: 'OFFSET_OTA_BOOT' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 1, OFFSET_OTA_BOOT, SIZE_OTA_BOOT, }, ^ user/user_main.c:144:60: error: 'SIZE_OTA_BOOT' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 1, OFFSET_OTA_BOOT, SIZE_OTA_BOOT, }, ^ user/user_main.c:145:41: error: 'OFFSET_OTA_RBOOT_CFG' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 2, OFFSET_OTA_RBOOT_CFG, SIZE_OTA_RBOOT_CFG, }, ^ user/user_main.c:145:64: error: 'SIZE_OTA_RBOOT_CFG' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 2, OFFSET_OTA_RBOOT_CFG, SIZE_OTA_RBOOT_CFG, }, ^ user/user_main.c:146:41: error: 'OFFSET_OTA_IMG_0' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 3, OFFSET_OTA_IMG_0, SIZE_OTA_IMG, }, ^ user/user_main.c:146:61: error: 'SIZE_OTA_IMG' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 3, OFFSET_OTA_IMG_0, SIZE_OTA_IMG, }, ^ user/user_main.c:147:41: error: 'OFFSET_OTA_IMG_1' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 4, OFFSET_OTA_IMG_1, SIZE_OTA_IMG, }, ^ user/user_main.c:148:41: error: 'SEQUENCER_FLASH_OFFSET_0' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 5, SEQUENCER_FLASH_OFFSET_0, SEQUENCER_FLASH_SIZE, }, ^ user/user_main.c:148:67: error: 'SEQUENCER_FLASH_SIZE' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 5, SEQUENCER_FLASH_OFFSET_0, SEQUENCER_FLASH_SIZE, }, ^ user/user_main.c:149:41: error: 'SEQUENCER_FLASH_OFFSET_1' undeclared here (not in a function) { SYSTEM_PARTITION_CUSTOMER_BEGIN + 6, SEQUENCER_FLASH_OFFSET_1, SEQUENCER_FLASH_SIZE, }, ^ user/user_main.c:151:2: error: expected identifier or '(' before '/' token */ ^ user/user_main.c:178:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void' iram void user_pre_init(void) ^ mingw32-make.exe: *** [build/user/user_main.o] Error 1

scargill commented 6 years ago

Above I am in user_main.c and clearly it knows nothing about those definitions...

eriksl commented 6 years ago

As said, this serves as an example, not as a ready-to-copy-and-paste piece of code.

Most of the partitions mentioned you will not have in your code. Also the second column consists of actual memory addresses. I have put them into an enum for readability, which is declared in some include. For your project you must find out what adresses it uses and fill them in.

The partitions from "SYSTEM_PARTITION_CUSTOMER_BEGIN + 0" on are probably not required or useful for your project. That's why they're called "customer" partitions. For the others you will have to find out what to use as actual address.

scargill commented 6 years ago

Right - getting nearer..

So I need this.. { SYSTEM_PARTITION_RF_CAL, RFCAL_OFFSET, RFCAL_SIZE, }, { SYSTEM_PARTITION_PHY_DATA, PHYDATA_OFFSET, PHYDATA_SIZE, }, { SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_CONFIG_OFFSET, SYSTEM_CONFIG_SIZE, },

Having removed the wor irsm from the pre-init function, that error went away.

Errors now are:

CC user/user_main.c user/user_main.c:137:1: error: unknown type name 'partition_item_t' static const partition_item_t partition_items[] = ^ user/user_main.c:139:4: error: 'SYSTEM_PARTITION_RF_CAL' undeclared here (not in a function) { SYSTEM_PARTITION_RF_CAL, RFCAL_OFFSET, RFCAL_SIZE, }, ^ user/user_main.c:139:33: error: 'RFCAL_OFFSET' undeclared here (not in a function) { SYSTEM_PARTITION_RF_CAL, RFCAL_OFFSET, RFCAL_SIZE, }, ^ user/user_main.c:139:50: error: 'RFCAL_SIZE' undeclared here (not in a function) { SYSTEM_PARTITION_RF_CAL, RFCAL_OFFSET, RFCAL_SIZE, }, ^ user/user_main.c:140:4: error: 'SYSTEM_PARTITION_PHY_DATA' undeclared here (not in a function) { SYSTEM_PARTITION_PHY_DATA, PHYDATA_OFFSET, PHYDATA_SIZE, }, ^ user/user_main.c:140:34: error: 'PHYDATA_OFFSET' undeclared here (not in a function) { SYSTEM_PARTITION_PHY_DATA, PHYDATA_OFFSET, PHYDATA_SIZE, }, ^ user/user_main.c:140:53: error: 'PHYDATA_SIZE' undeclared here (not in a function) { SYSTEM_PARTITION_PHY_DATA, PHYDATA_OFFSET, PHYDATA_SIZE, }, ^ user/user_main.c:141:4: error: 'SYSTEM_PARTITION_SYSTEM_PARAMETER' undeclared here (not in a function) { SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_CONFIG_OFFSET, SYSTEM_CONFIG_SIZE, }, ^ user/user_main.c:141:40: error: 'SYSTEM_CONFIG_OFFSET' undeclared here (not in a function) { SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_CONFIG_OFFSET, SYSTEM_CONFIG_SIZE, }, ^ user/user_main.c:141:63: error: 'SYSTEM_CONFIG_SIZE' undeclared here (not in a function) { SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_CONFIG_OFFSET, SYSTEM_CONFIG_SIZE, }, ^ mingw32-make.exe: *** [build/user/user_main.o] Error 1

In other words, just those 9 definitions and the unknown type name partition_item_t.

I'm afraid they mean nothing to me. Can you suggest any starting points? I use RBOOT - the only address I know of is the start address fof my code above RBOOT - ie 2000h. And I'm only using the ESP12 with4 MB flash.

kriegste commented 6 years ago

Looks like you copied the struct but forgot the defines. You do not have to use defines. Just put in the addresses and sizes by hand (depending on your flash map and config).

eriksl commented 6 years ago

That's what I said already.

Minus the #define plus enum. #define is evil.

scargill commented 6 years ago

Sorry I didn't see the defines. I put them in, picked the various options in turn and all the error messages went away... however... back to square 1.

c:/espressif/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: build/app_0.out section .text' will not fit in regioniram1_0_seg'

kriegste commented 6 years ago

Then you will need to walk through all your code and Makefile. There are countless reasons... Just a few:

scargill commented 6 years ago

The point being - on SDK 2.1 my code works perfectly and I have room to spare.. I thought it would be snsile to "upgrade" to the latest SDK as I always did until 2.2 told me not enough room just as here. I am using ICACHE_FLASH_ATTR on virtually everything. I definitely have that -DICACH_FLASH flag. Not seeing any reference to libgcc.a in my make file -or was there supposed to be a space in there?

kriegste commented 6 years ago

Well, like I already said elsewhere, the SDK is getting fatter and fatter. :P

eriksl commented 6 years ago

I don't agree. The only thing that matters is the IRAM usage, that is hard limited to 32 kbyte. A lot of the space is taken up bij the SDK code BUT the exact amount has been varying between releases and currently it's quite not the most, as Espressif has taken of lot of effort reducing the SDK IRAM footprint. One of the efforts to achieve that was to create linkage units for every separate function instead of having a linkage unit per source file. That means that if you only need one function from a source file, the linker won't draw in all the other functions from the same source file. This has made a huge difference. BUT for that to work, you need to change your linker script, Espressif has shown how to do that. If you fail to do that, you will end up with LESS instead of MORE free IRAM space. I have said that before in this thread. You can hardly blame Espressif for that.

96 kbytes of DRAM is quite a huge pile, for embedded systems. If you use it wisely, it is not going to be a bottleneck. E.g. make sure it's not wasted by text strings that are needlessly copied to DRAM on startup.

And for code size, that's virtually unlimited, using a 4 Mbyte or even 16 Mbyte flash (the max).

If you feel you are too limited by these numbers (i.e. you don't have the skills to make sufficiently light code), maybe the more user-friendly ESP32 is more appropriate, or something like Raspberry etc.

For me the ESP8266 is still a huge step forward from the ATTiny's I used before, with 2 Kb flash memory and 512 bytes DRAM....

kriegste commented 6 years ago

Maybe @scargill can post his Makefile and we can have a look at it.

scargill commented 6 years ago

The ESP8266 is truly marvellous, no doubt,, but Espressif seem to make a lot of assumptions about people’s skill. I am VERY good with C coding, but not THAT familiar with Linux and the details of the compiler and Linker. I’ve used from SDK 15 to 2.1 and would LOVE to keep up to date but I have other duties which stop me spending all day researching Espressif info and don’t really understand where everything goes. I know RBOOT goes to 0, my code starts at 2000h, near the top of the 1 meg space is the user data. I tried that code yesterday and the errors seemed to go away but then – no room – just as before. I don’t know how to progress other than sticking with SDK 2.1 unless someone can help.

I’ll respond to Kriegste

Pete

From: Erik Slagter [mailto:notifications@github.com] Sent: 12 November 2018 13:38 To: espressif/ESP8266_NONOS_SDK ESP8266_NONOS_SDK@noreply.github.com Cc: Peter Scargill pete@scargill.org; Comment comment@noreply.github.com Subject: Re: [espressif/ESP8266_NONOS_SDK] How to use rBoot with v3.0 ? (#163)

I don't agree. The only thing that matters is the IRAM usage, that is hard limited to 32 kbyte. A lot of the space is taken up bij the SDK code BUT the exact amount has been varying between releases and currently it's quite not the most, as Espressif has taken of lot of effort reducing the SDK IRAM footprint. One of the efforts to achieve that was to create linkage units for every separate function instead of having a linkage unit per source file. That means that if you only need one function from a source file, the linker won't draw in all the other functions from the same source file. This has made a huge difference. BUT for that to work, you need to change your linker script, Espressif has shown how to do that. If you fail to do that, you will end up with LESS instead of MORE free IRAM space. I have said that before in this thread. You can hardly blame Espressif for that.

96 kbytes of DRAM is quite a huge pile, for embedded systems. If you use it wisely, it is not going to be a bottleneck. E.g. make sure it's not wasted by text strings that are needlessly copied to DRAM on startup.

And for code size, that's virtually unlimited, using a 4 Mbyte or even 16 Mbyte flash (the max).

If you feel you are too limited by these numbers (i.e. you don't have the skills to make sufficiently light code), maybe the more user-friendly ESP32 is more appropriate, or something like Raspberry etc.

For me the ESP8266 is still a huge step forward from the ATTiny's I used before, with 2 Kb flash memory and 512 bytes DRAM....

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/espressif/ESP8266_NONOS_SDK/issues/163#issuecomment-437883059 , or mute the thread https://github.com/notifications/unsubscribe-auth/ABzUg0JTS70eJAkIoIcp4ie-TmJ8g76vks5uuXnBgaJpZM4WLOuH . https://github.com/notifications/beacon/ABzUg3Fa3AZ93ZutuoOvdH-SmzrYojBzks5uuXnBgaJpZM4WLOuH.gif

scargill commented 6 years ago

Here as requested is my MAKE file (runs in Windows with the onofficial 8266 dev kit and Eclipse. Mskefile as requested...

`############################################################# #

Root Level Makefile

#

(c) by CHERTS sleuthhound@gmail.com

#

esp_mqtt_dev2

# #############################################################

*** if you change RBOOT_BIG_FLASH you must 'make clean' and build again

RBOOT_BIG_FLASH ?= 1

BUILD_BASE = build FW_BASE = firmware

PYTHON ?= C:\Python27\python.exe ROM1MEG ?= C:\espressif\utils\blank_1MB.bin

UTILROMS ?= C:\Users\User\documents\esp-go\firmware VERFILE ?= C:\Users\User\documents\esp-go\include\user_config.h

WEBTOOL ?= c:\Espressif\utils\web_page_convert.py

WEBTOOL ?= web_page_convert.py FIND ?= find FLASH_OPTS ?= -fs 32m -ff 80m -fm qio FLASH_DIO ?= -fs 32m -ff 80m -fm dio

Base directory for the compiler

XTENSA_TOOLS_ROOT ?= c:/Espressif/xtensa-lx106-elf/bin

NEWSTUFF ?= c:/Espressif/esp8266_sdk/bin

base directory of the ESP8266 SDK package, absolute

SDK_BASE ?= c:/Espressif/ESP8266_SDK SDK_TOOLS ?= c:/Espressif/utils

Extra Tensilica includes from the ESS VM

SDK_EXTRA_INCLUDES ?= c:/Espressif/ESP8266_SDK/include SDK_EXTRA_LIBS ?= c:/Espressif/ESP8266_SDK/lib

esptool path and port

ESPTOOL ?=c:/espressif/utils/esptool.exe ESPPORT ?=COM8 ESPBAUD ?=230400 ESPTOOL2 ?= C:/esptools/esptool2.exe

Position and maximum length of espfs in flash memory

ESPFS_POS = 0x70000 ESPFS_SIZE = 0x08000

Static gzipping is disabled by default.

GZIP_COMPRESSION ?= no

If USE_HEATSHRINK is set to "yes" then the espfs files will be compressed with Heatshrink and decompressed

on the fly while reading the file. Because the decompression is done in the esp8266, it does not require

any support in the browser.

USE_HEATSHRINK ?= yes

name for the target project

TARGET = app

which modules (subdirectories) of the project to include in compiling

MODULES = driver mqtt user softuart easygpio rboot/appcode

EXTRA_INCDIR = include $(SDK_BASE)/../include \ . \ lib/heatshrink/ \ mqtt \ $(SDK_EXTRA_INCLUDES)

various paths from the SDK used in this project

SDK_LIBDIR = lib SDK_LDDIR = ld SDK_INCDIR = include include/json

compiler flags

CFLAGS = -w -Os -ggdb -std=c99 -Wpointer-arith -Wundef -Wall -Wl,-EL -fno-inline-functions \ -nostdlib -mlongcalls -mtext-section-literals -Dets -DICACHE_FLASH -D_STDINT_H \ -Wno-address -DESPFS_POS=$(ESPFS_POS) -DESPFS_SIZE=$(ESPFS_SIZE)

CFLAGS = -w -Os -ggdb -std=gnu89 -Wpointer-arith -Wundef -Wall -Wl,-EL -fno-inline-functions \

-nostdlib -mlongcalls -mtext-section-literals -Dets -DICACHE_FLASH -D_STDINT_H \

-Wno-address -DESPFS_POS=$(ESPFS_POS) -DESPFS_SIZE=$(ESPFS_SIZE)

linker flags used to generate the main object file

LDFLAGS = -nostdlib -Wl,--no-check-sections -u Cache_Read_Enable_New, -u call_user_start -Wl,-static -Wl,-Map,foo.map

rBoot build support

RBOOT_OUT_0 := $(addprefix $(BUILD_BASE)/,$(TARGET)_0.out) RBOOT_OUT_1 := $(addprefix $(BUILD_BASE)/,$(TARGET)_1.out) RBOOT_LD_0 ?= rom0 RBOOT_LD_1 ?= rom1 RBOOT_LD_0 := $(addprefix -T,$(RBOOT_LD_0).ld) RBOOT_LD_1 := $(addprefix -T,$(RBOOT_LD_1).ld) RBOOT_E2_SECTS ?= .text .data .rodata RBOOT_E2_USER_ARGS ?= -quiet -bin -boot2 RBOOT_BIN := $(FW_BASE)/rboot.bin RBOOT_BUILD_BASE := $(abspath $(BUILD_BASE)) RBOOT_FW_BASE := $(abspath $(FW_BASE)) EXTRA_INCDIR += rboot EXTRA_INCDIR += rboot/appcode

libmain must be modified for rBoot big flash support (just one symbol gets weakened)

ifeq ($(RBOOT_BIG_FLASH),1) LIBMAIN = main2 LIBMAIN_SRC = $(addprefix $(SDK_LIBDIR)/,libmain.a) LIBMAIN_DST = $(addprefix $(BUILD_BASE)/,libmain2.a) CFLAGS += -DBOOT_BIG_FLASH LDFLAGS += -u Cache_Read_Enable_New RBOOT_ROM_0 ?= rom RBOOT_ROM_0 := $(addprefix $(FW_BASE)/,$(RBOOT_ROM_0).bin) RBOOT_ROM_1 := $() RBOOT_ROM_1 := $(addprefix $(FW_BASE)/,$(RBOOT_ROM_1).bin) else LIBMAIN = main LIBMAIN_DST = $() RBOOT_ROM_0 ?= rom0 RBOOT_ROM_1 ?= rom1 endif

these are exported for use by the rBoot Makefile

export RBOOT_BIG_FLASH export RBOOT_BUILD_BASE export RBOOT_FW_BASE export ESPTOOL2 export XTENSA_BINDIR = $(XTENSA_TOOLS_ROOT)

libraries used in this project, mainly provided by the SDK

LIBS = cirom gcc hal phy pp net80211 lwip wpa pwm upgrade $(LIBMAIN) ssl crypto

LIBS = c gcc hal phy pp net80211 lwip wpa pwm upgrade $(LIBMAIN) ssl crypto

select which tools to use as compiler, librarian and linker

CC := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc AR := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-ar LD := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc OBJCOPY := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objcopy OBJDUMP := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objdump

no user configurable options below here

SRC_DIR := $(MODULES) BUILD_DIR := $(addprefix $(BUILD_BASE)/,$(MODULES))

SDK_LIBDIR := $(addprefix $(SDK_BASE)/,$(SDK_LIBDIR)) SDK_INCDIR := $(addprefix -I$(SDK_BASE)/,$(SDK_INCDIR))

SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.c)) OBJ := $(patsubst %.c,$(BUILD_BASE)/%.o,$(SRC)) LIBS := $(addprefix -l,$(LIBS)) APP_AR := $(addprefix $(BUILD_BASE)/,$(TARGET)_app.a) TARGET_OUT := $(addprefix $(BUILD_BASE)/,$(TARGET).out)

INCDIR := $(addprefix -I,$(SRC_DIR)) EXTRA_INCDIR := $(addprefix -I,$(EXTRA_INCDIR)) MODULE_INCDIR := $(addsuffix /include,$(INCDIR))

ifeq ("$(GZIP_COMPRESSION)","yes") CFLAGS += -DGZIP_COMPRESSION endif

ifeq ("$(USE_HEATSHRINK)","yes") CFLAGS += -DESPFS_HEATSHRINK endif

ifneq ("$(WIFI_AP_NAME)", "") CFLAGS += -DWIFI_AP_NAME=\"$(WIFI_AP_NAME)\" endif ifneq ("$(WIFI_AP_PASSWORD)", "") CFLAGS += -DWIFI_AP_PASSWORD=\"$(WIFI_AP_PASSWORD)\" endif ifneq ("$(WIFI_CLIENTSSID)", "") CFLAGS += -DWIFI_CLIENTSSID=\"$(WIFI_CLIENTSSID)\" endif ifneq ("$(WIFI_CLIENTPASSWORD)", "") CFLAGS += -DWIFI_CLIENTPASSWORD=\"$(WIFI_CLIENTPASSWORD)\" endif

ifneq ("$(MQTT_HOST)", "") CFLAGS += -DMQTT_HOST=\"$(MQTT_HOST)\" endif ifneq ("$(MQTT_PORT)", "") CFLAGS += -DMQTT_PORT=\"$(MQTT_PORT)\" endif ifneq ("$(MQTT_USER)", "") CFLAGS += -DMQTT_USER=\"$(MQTT_USER)\" endif ifneq ("$(MQTT_PASS)", "") CFLAGS += -DMQTT_PASS=\"$(MQTT_PASS)\" endif ifneq ("$(OTA_HOST)", "") CFLAGS += -DOTA_HOST=\"$(OTA_HOST)\" endif ifneq ("$(OTA_PORT)", "") CFLAGS += -DOTA_PORT=\"$(OTA_PORT)\" endif

vpath %.c $(SRC_DIR)

define compile-objects $1/%.o: %.c @echo "CC $$<" @$(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@ endef

.PHONY: all clean flash flashinit flashonefile htmlfiles

all: $(BUILD_DIR) $(FW_BASE) user/webpage.h $(RBOOT_BIN) $(LIBMAIN_DST) $(RBOOT_ROM_0) $(RBOOT_ROM_1)

$(FW_BASE)/webpages.espfs: $(FW_BASE)

$(RBOOT_BIN): @$(MAKE) -C rboot

$(LIBMAIN_DST): $(LIBMAIN_SRC) @echo "OC $@" @$(OBJCOPY) -W Cache_Read_Enable_New $^ $@

$(RBOOT_ROM_0): $(RBOOT_OUT_0) @echo "E2 $@" @$(ESPTOOL2) $(RBOOT_E2_USER_ARGS) $(RBOOT_OUT_0) $@ $(RBOOT_E2_SECTS)

$(RBOOT_ROM_1): $(RBOOT_OUT_1) @echo "E2 $@" @$(ESPTOOL2) $(RBOOT_E2_USER_ARGS) $(RBOOT_OUT_1) $@ $(RBOOT_E2_SECTS)

$(RBOOT_OUT_0): $(APP_AR) @echo "LD $@" @$(LD) -L$(BUILD_BASE) -L$(SDK_LIBDIR) $(RBOOT_LD_0) $(LDFLAGS) -Wl,--start-group $(APP_AR) $(LIBS) -Wl,--end-group -o $@ @echo "------------------------------------------------------------------------------" @echo "Section info:" @$(OBJDUMP) -h -j .data -j .rodata -j .bss -j .text -j .irom0.text $@ @echo "------------------------------------------------------------------------------"

$(RBOOT_OUT_1): $(APP_AR) @echo "LD $@" @$(LD) -L$(BUILD_BASE) -L$(SDK_LIBDIR) $(RBOOT_LD_1) $(LDFLAGS) -Wl,--start-group $(APP_AR) $(LIBS) -Wl,--end-group -o $@

user/webpage.h: $(FW_BASE)/webpages.espfs $(PYTHON) $(WEBTOOL) firmware/webpages.espfs user/webpage.h

$(FW_BASE)/webpages.espfs: @echo "FS $@" cd html; $(FIND) | ../mkespfsimage/mkespfsimage.exe > ../$@; cd ..

$(APP_AR): $(OBJ) @echo "AR $@" @$(AR) cru $@ $^

$(BUILD_DIR): @mkdir -p $@

$(FW_BASE): @mkdir -p $@

if test -d  $(UTILROMS); \
then cp -f c:/Espressif/esp8266_sdk/bin/blank.bin   $(UTILROMS); \
cp -f c:/Espressif/esp8266_sdk/bin/esp_init_data_default.bin     $(UTILROMS); \
fi

wipe_all: $(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) erase_flash

flash: all $(PYTHON) dtr.py $(ESPPORT) $(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(FLASH_OPTS) 0x00000 $(RBOOT_BIN) 0x02000 $(RBOOT_ROM_0)

flashdio: all $(PYTHON) dtr.py $(ESPPORT) $(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(FLASH_DIO) 0x00000 $(RBOOT_BIN) 0x02000 $(RBOOT_ROM_0)

init_blank: all $(PYTHON) dtr.py $(ESPPORT) $(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(FLASH_OPTS) 0x3FE000 $(NEWSTUFF)/blank.bin

init_data: all $(PYTHON) dtr.py $(ESPPORT) $(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(FLASH_OPTS) 0x3FC000 $(NEWSTUFF)/esp_init_data_default.bin

flash_4MB_init: all $(PYTHON) dtr.py $(ESPPORT) $(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(FLASH_OPTS) 0x00000 $(RBOOT_BIN) 0x02000 $(RBOOT_ROM_0) 0x3FE000 $(NEWSTUFF)/blank.bin 0x3FC000 $(NEWSTUFF)/esp_init_data_default.bin

flash_1MB_init: all $(PYTHON) dtr.py $(ESPPORT) $(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(FLASH_OPTS) 0x00000 $(RBOOT_BIN) 0x02000 $(RBOOT_ROM_0) 0x0FE000 $(NEWSTUFF)/blank.bin 0x0FC000 $(NEWSTUFF)/esp_init_data_default.bin

flash_512K_init: all $(PYTHON) dtr.py $(ESPPORT) $(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(FLASH_OPTS) 0x00000 $(RBOOT_BIN) 0x02000 $(RBOOT_ROM_0) 0x07E000 $(NEWSTUFF)/blank.bin 0x07C000 $(NEWSTUFF)/esp_init_data_default.bin

ota_store: $(PYTHON) $(SDK_TOOLS)/ftp_upload.py $(FW_BASE)/rboot.bin $(PYTHON) $(SDK_TOOLS)/ftp_upload.py $(FW_BASE)/rom.bin

ota_store_webutu: $(PYTHON) $(SDK_TOOLS)/ftp_upload_webutu.py $(FW_BASE)/rboot.bin $(PYTHON) $(SDK_TOOLS)/ftp_upload_webutu.py $(FW_BASE)/rom.bin grep SYSTEM_VER include/user_config.h | cut -d\ -f3 | tr -d '"' > $(FW_BASE)/version.html echo " " >> $(FW_BASE)/version.html grep SYSTEM_COMMENT include/user_config.h | cut -d\" -f2 >> $(FW_BASE)/version.html $(PYTHON) $(SDK_TOOLS)/ftp_upload_webutu.py $(FW_BASE)/version.html

ota_all: ota_store ota_store_webutu

clean: @echo "RM $(BUILD_BASE)" @rm -rf $(BUILD_BASE) @echo "RM $(FW_BASE)" @rm -rf $(FW_BASE)

$(foreach bdir,$(BUILD_DIR),$(eval $(call compile-objects,$(bdir))))

rebuild: $(info " REBUILDING ALL ") clean all `

kriegste commented 6 years ago

As a starting point, try adding -Wl,-gc-sections to your LDFLAGS.

scargill commented 6 years ago

Apparently there is no such thing as -W1 (I already have -Wl (ie lower case L) and -gc and -gc-sections both come up as invalid.

# linker flags used to generate the main object file LDFLAGS = -nostdlib -Wl,--no-check-sections -u Cache_Read_Enable_New, -u call_user_start -Wl,-static -Wl,-Map,foo.map

kriegste commented 6 years ago

Try copy&paste, just append it (with a space before it; no space between , and -).

scargill commented 6 years ago

This exact phrase?
-Wl,-gc-sections

with a comma before it, to the end of my LDFLAGS?

kriegste commented 6 years ago

That exact phrase with a space before it.

scargill commented 6 years ago

`# linker flags used to generate the main object file LDFLAGS = -nostdlib -Wl,--no-check-sections -u Cache_Read_Enable_New, -u call_user_start -Wl,-static -Wl,-Map,foo.map, -Wl,-gc-sections

invalid argument. Sorry to be thick... `

scargill commented 6 years ago

no errors now, but still

c:/espressif/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: build/app_0.out section.text' will not fit in region iram1_0_seg'

scargill commented 6 years ago

Well, if nothing else, adding that in gives me more space in SDK 2.1 - from 7950 down to 7774. That's good.

kriegste commented 6 years ago

Have you tried going back to the original boot loader? When I google rboot, I find two year old code with three year old linker files. And you seem to use non-standard linker files. Maybe this is the cause. Too much has changed since then.

scargill commented 6 years ago

Possible of course, but I’ve no idea what’s needed… Make files are not exactly my key skill.

Pete

From: kriegste [mailto:notifications@github.com] Sent: 12 November 2018 15:27 To: espressif/ESP8266_NONOS_SDK ESP8266_NONOS_SDK@noreply.github.com Cc: Peter Scargill pete@scargill.org; Mention mention@noreply.github.com Subject: Re: [espressif/ESP8266_NONOS_SDK] How to use rBoot with v3.0 ? (#163)

Have you tried going back to the original boot loader? When I google rboot, I find two year old code with three year old linker files. And you seem to use non-standard linker files. Maybe this is the cause. Too much has changed since then.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/espressif/ESP8266_NONOS_SDK/issues/163#issuecomment-437921707 , or mute the thread https://github.com/notifications/unsubscribe-auth/ABzUgyvR23aPaNpOd5rKH7ZJZ84H_Jxdks5uuZM8gaJpZM4WLOuH . https://github.com/notifications/beacon/ABzUg55BY99isrL3eUFWhFOeJOdVud3Cks5uuZM8gaJpZM4WLOuH.gif

eriksl commented 6 years ago

Using RBOOT doesn't add any code to the IRAM section, unless you're using the BIGFLASH option, then it adds about 150 bytes, not worth mentioning.

Rboot hasn't change much over the last few years and that's because it just works. Just a few extra options have been added. For instance it can now fetch from RTC memory what slot needs to be booted, making it possible to implement a fail-safe boot. Very convenient when you're OTA flashing and you can't easily reach the device.

kriegste commented 6 years ago

Then maybe the problems lie in his linker files (ld files)?

scargill commented 6 years ago

What I don’t understand is, what can be so wrong with the files I use… They’ve worked reliably from SDK 1.odd to 2.1 without issue on many upgrades to my software and many different ESP boards.

Stills, happy to look at whatever needs doing to let me move to the latest SDK.

Pete

From: kriegste [mailto:notifications@github.com] Sent: 12 November 2018 17:43 To: espressif/ESP8266_NONOS_SDK ESP8266_NONOS_SDK@noreply.github.com Cc: Peter Scargill pete@scargill.org; Mention mention@noreply.github.com Subject: Re: [espressif/ESP8266_NONOS_SDK] How to use rBoot with v3.0 ? (#163)

Then maybe the problems lie in his linker files (ld files)?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/espressif/ESP8266_NONOS_SDK/issues/163#issuecomment-437969157 , or mute the thread https://github.com/notifications/unsubscribe-auth/ABzUg_NS8g3L4wbkJHGAgNhyxQ6DkLkMks5uubMzgaJpZM4WLOuH . https://github.com/notifications/beacon/ABzUg6d1Ufd8XbpjoTjEr4ELNwtOoxWwks5uubMzgaJpZM4WLOuH.gif

eriksl commented 6 years ago

This, I quote myself from a few posts back:

A lot of the space is taken up bij the SDK code BUT the exact amount has been varying between releases and currently it's quite not the most, as Espressif has taken of lot of effort reducing the SDK IRAM footprint. One of the efforts to achieve that was to create linkage units for every separate function instead of having a linkage unit per source file. That means that if you only need one function from a source file, the linker won't draw in all the other functions from the same source file. This has made a huge difference. BUT for that to work, you need to change your linker script, Espressif has shown how to do that. If you fail to do that, you will end up with LESS instead of MORE free IRAM space.