All compiler and linker flags were manually setup and I have a successful compilation and linking.
But then depending on the order of my linkage, my application runs or not.
If I link with the below command, the application runs perfectly
xtensa-lx106-elf-gcc -L"C:\ESP8266\esp8266-bsp\RTOS-SDK\lib" -L"C:\ESP8266\HAL" -nostdlib -u call_user_start -Wl,-static -TC:/ESP8266/esp8266-bsp/RTOS-SDK/ld/eagle.app.v6.ld -Wl,--gc-sections -o "RGBDisplay" -Wl,--start-group -lminic -lmirom -lcirom -lm -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lcrypto -lmain -lfreertos -llwip -lssc -lspiffs -Wl,--end-group ./main.o
But you see the linking order is wrong as main.o should appear before all the SDK libraries. If I eventually reference some library code from my main.o, I get error 'undefined references to xxx'.
So I had to order my linkage as
xtensa-lx106-elf-gcc -L"C:\ESP8266\esp8266-bsp\RTOS-SDK\lib" -L"C:\ESP8266\HAL" -nostdlib -u call_user_start -Wl,-static -TC:/ESP8266/esp8266-bsp/RTOS-SDK/ld/eagle.app.v6.ld -Wl,--gc-sections -o "RGBDisplay" -Wl,--start-group ./main.o -lminic -lmirom -lcirom -lm -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lcrypto -lmain -lfreertos -llwip -lssc -lspiffs -Wl,--end-group
Compilation and linkage is still successful, but then it wont run on the target ESP8266.
I also tried
xtensa-lx106-elf-gcc -L"C:\ESP8266\esp8266-bsp\RTOS-SDK\lib" -L"C:\ESP8266\HAL" -nostdlib -u call_user_start -Wl,-static -TC:/ESP8266/esp8266-bsp/RTOS-SDK/ld/eagle.app.v6.ld -Wl,--gc-sections -o "RGBDisplay" ./main.o -Wl,--start-group -lminic -lmirom -lcirom -lm -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lcrypto -lmain -lfreertos -llwip -lssc -lspiffs -Wl,--end-group
And it wont run either.
I am certainly missing something. Right?
Thanks for your response.