raburton / rboot-sample

Sample ESP 8266 SDK project demonstrating rBoot OTA
MIT License
23 stars 11 forks source link

make: *** [build/rom0.elf] Error 1 #4

Open toxicnaan opened 7 years ago

toxicnaan commented 7 years ago

Hi,

I've compiled the esp-open-sdk + esp2tool + rboot, all from master git branches, all seem to compile successfully.\

However, when i building rboot-sample i get

make CC main.c CC rboot-api.c CC rboot-ota.c CC uart.c LD rom0.elf /Volumes/case-sensitive/esp-open-sdk/sdk/lib/libmain.a(spi_flash.o): In function flash_gd25q32c_write_status': (.text+0x6d0): undefined reference toEnable_QMode' /Volumes/case-sensitive/esp-open-sdk/sdk/lib/libmain.a(spi_flash.o): In function flash_gd25q32c_write_status': (.text+0x6e1): undefined reference toEnable_QMode' collect2: error: ld returned 1 exit status make: *** [build/rom0.elf] Error 1

I have tried compiling the SDK, with both

make STANDALONE=y and just the default build with 'make'.

Hope you can help.

raburton commented 7 years ago

Those errors are coming from libmain, not rBoot code. Perhaps there is another library you need to link against containing the missing symbols?

daffysub commented 7 years ago

Hello,

I encountered the same issue but with other lib:

..//lib/libmain.a(app_main.o): In function flash_data_check': (.irom0.text+0x75c): undefined reference touser_rf_cal_sector_set' ..//lib/libmain.a(app_main.o): In function flash_data_check': (.irom0.text+0x8d7): undefined reference touser_rf_cal_sector_set' ..//lib/libmain.a(spi_flash.o): In function flash_gd25q32c_write_status': (.text+0x6d0): undefined reference toEnable_QMode' ..//lib/libmain.a(spi_flash.o): In function flash_gd25q32c_write_status': (.text+0x6e1): undefined reference toEnable_QMode' collect2: error: ld returned 1 exit status make: *** [build/rom0.elf] Error 1

I'm not easy with makefile. how can we do the link? And how can we chose the good symbols to link?

Thank you in advance for your help.

raburton commented 7 years ago

A quick google found this page: https://github.com/esp8266/Arduino/issues/2304 where is was stated the user_rf_cal_sector_set function needs to be added by the user. If you don't know what it's for or why it's needed (I don't) you could probably just take the version they have put in their code. Enable_QMode is also mentioned on that page.

daffysub commented 7 years ago

Hi Raburton,

Thank for you're reply. I put my question here because my quick google search was not a success...

For an explicite solution, see the following : For the user_rf_cal_sector_set, we have to put the followinf funciton in main.c : uint32 ICACHE_FLASH_ATTR user_rf_cal_sector_set(void) { enum flash_size_map size_map = system_get_flash_size_map(); uint32 rf_cal_sec = 0;

switch (size_map) {
    case FLASH_SIZE_4M_MAP_256_256:
        rf_cal_sec = 128 - 8;
        break;

    case FLASH_SIZE_8M_MAP_512_512:
        rf_cal_sec = 256 - 5;
        break;

    case FLASH_SIZE_16M_MAP_512_512:
    case FLASH_SIZE_16M_MAP_1024_1024:
        rf_cal_sec = 512 - 5;
        break;

    case FLASH_SIZE_32M_MAP_512_512:
    case FLASH_SIZE_32M_MAP_1024_1024:
        rf_cal_sec = 1024 - 5;
        break;

    default:
        rf_cal_sec = 0;
        break;
}

return rf_cal_sec;

}

Then for the second point, Enable_QMode: We have to add this line PROVIDE ( Enable_QMode = 0x400044c0 ); in the eagle.rom.addr.v6.ld present in rboot-sample directory

And now it's OK.