-->
Page 1 of 1

Using the SDK - Building problems

PostPosted: Sat Feb 11, 2017 10:29 am
by nickagian
By following the instructions found here https://github.com/esp8266/esp8266-wiki/wiki/Toolchain, I tried installing the toolchain under Linux Mint (kernel 4.4.0-21).

I completed all steps with success (I took the latest SDK release, v1.2.0), but unfortunately when it comes to building one of the examples at https://github.com/esp8266/source-code-examples.git, I have many difficulties.

For example when I tried building the "blinky" example, I received the following error messages:

Code: Select allCC user/user_main.c
AR build/app_app.a
LD build/app.out
/opt/Espressif/ESP8266_SDK/lib/libmain.a(app_main.o): In function `user_uart_wait_tx_fifo_empty':
(.irom0.text+0x324): undefined reference to `user_rf_pre_init'
/opt/Espressif/ESP8266_SDK/lib/libmain.a(app_main.o): In function `user_uart_wait_tx_fifo_empty':
(.irom0.text+0x443): undefined reference to `user_rf_pre_init'
collect2: error: ld returned 1 exit status
Makefile:116: recipe for target 'build/app.out' failed
make: *** [build/app.out] Error 1


Could someone help me with this? I am not yet so familiar with the tools, so I don't understand what's wrong. It seems as if the tools can't find some function (user_rf_pre_init). How could that be?

UPDATE
I found a solution to overcome this problem. This was to create a dummy void user_rf_pre_init(void){} function in the user_main.c file of the examples. Then the process moved on but another difficulty occurred. Now esptool.py throws an error:

Code: Select allFW firmware/
esptool.py v2.0-beta1
WARNING: Unexpected ELF section header length a99c is not mod-28
Traceback (most recent call last):
  File "/usr/local/bin/esptool.py", line 4, in <module>
    __import__('pkg_resources').run_script('esptool==2.0b1', 'esptool.py')
  File "/home/nikos/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 738, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/nikos/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1506, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/esptool-2.0b1-py2.7.egg/EGG-INFO/scripts/esptool.py", line 2270, in <module>
   
  File "/usr/local/lib/python2.7/dist-packages/esptool-2.0b1-py2.7.egg/EGG-INFO/scripts/esptool.py", line 2072, in main
   
  File "/usr/local/lib/python2.7/dist-packages/esptool-2.0b1-py2.7.egg/EGG-INFO/scripts/esptool.py", line 1689, in elf2image
   
  File "/usr/local/lib/python2.7/dist-packages/esptool-2.0b1-py2.7.egg/EGG-INFO/scripts/esptool.py", line 1302, in __init__
   
  File "/usr/local/lib/python2.7/dist-packages/esptool-2.0b1-py2.7.egg/EGG-INFO/scripts/esptool.py", line 1325, in _read_elf_file
   
  File "/usr/local/lib/python2.7/dist-packages/esptool-2.0b1-py2.7.egg/EGG-INFO/scripts/esptool.py", line 1342, in _read_sections
   
  File "/usr/local/lib/python2.7/dist-packages/esptool-2.0b1-py2.7.egg/EGG-INFO/scripts/esptool.py", line 1340, in read_section_header
   
struct.error: unpack_from requires a buffer of at least 24 bytes
Makefile:112: recipe for target 'firmware/0x00000.bin' failed
make: *** [firmware/0x00000.bin] Error 1


Any ideas?

Re: Using the SDK - Building problems

PostPosted: Sat Feb 11, 2017 2:49 pm
by martinayotte
It has been added awhile ago in SDK 1.10, but they never added a weak version, so you need to add empty one yourself in the demo code.

http://bbs.espressif.com/viewtopic.php?t=486#p1861

Re: Using the SDK - Building problems

PostPosted: Thu Feb 23, 2017 6:17 pm
by stinga
I am a me too... What do you need to help me fix the issue? I followed the steps at https://github.com/esp8266/esp8266-wiki/wiki/Toolchain without any errors...

Code: Select allmike@shark:/opt/Espressif/source-code-examples/blinky$ make
FW firmware/
esptool.py v2.0-beta2
WARNING: Unexpected ELF section header length a99c is not mod-28
Traceback (most recent call last):
  File "/opt/Espressif/esptool-py/esptool.py", line 2270, in <module>
    main()
  File "/opt/Espressif/esptool-py/esptool.py", line 2072, in main
    operation_func(args)
  File "/opt/Espressif/esptool-py/esptool.py", line 1689, in elf2image
    e = ELFFile(args.input)
  File "/opt/Espressif/esptool-py/esptool.py", line 1302, in __init__
    self._read_elf_file(f)
  File "/opt/Espressif/esptool-py/esptool.py", line 1325, in _read_elf_file
    self._read_sections(f, shoff, shstrndx)
  File "/opt/Espressif/esptool-py/esptool.py", line 1342, in _read_sections
    all_sections = [read_section_header(offs) for offs in section_header_offsets]
  File "/opt/Espressif/esptool-py/esptool.py", line 1340, in read_section_header
    name_offs,sec_type,_flags,lma,sec_offs,size = struct.unpack_from("<LLLLLL", section_header[offs:])
struct.error: unpack_from requires a buffer of at least 24 bytes
make: *** [firmware/0x00000.bin] Error 1
mike@shark:/opt/Espressif/source-code-examples/blinky$