[Solved]Updating IDF (3.3beta1 to 3.3LTS) causes errors on build custom project

newsettler_AI
Posts: 121
Joined: Wed Apr 05, 2017 12:49 pm

[Solved]Updating IDF (3.3beta1 to 3.3LTS) causes errors on build custom project

Postby newsettler_AI » Sun Sep 08, 2019 2:43 pm

Hi,

I have updated my IDF to 3.3LTS from 3.3beta1 and now I have some errors about undefined reference.

Code: Select all

make[1]: Leaving directory 'C:/ESP32/Projects/dev/build/xtensa-debug-module'
Target 'component-xtensa-debug-module-build' responsible for 'C:/ESP32/Projects/dev/build/xtensa-debug-module/libxtensa-debug-module.a'
C:/ESP32/Projects/dev/build/main\libmain.a(lcd.o):(.literal.draw_bt_logo+0x4): undefined reference to `bt_icon'
C:/ESP32/Projects/dev/build/main\libmain.a(lcd.o):(.literal.scr_show_battery+0x2c): undefined reference to `battery'
C:/ESP32/Projects/dev/build/main\libmain.a(lcd.o):(.literal.scr_main_menu+0x14): undefined reference to `meas_icon'
C:/ESP32/Projects/dev/build/main\libmain.a(lcd.o):(.literal.scr_result+0x44): undefined reference to `time_icon'
C:/ESP32/Projects/dev/build/main\libmain.a(lcd.o):(.literal.scr_logo_show+0x4): undefined reference to `logo'
collect2.exe: error: ld returned 1 exit status
Not sure why this happens, since on beta version idf with same includes everything compiles and all "bt_icon" , "battery" ect stuff was find properly :shock:
Last edited by newsettler_AI on Thu Sep 12, 2019 4:47 pm, edited 1 time in total.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Updating IDF (3.3beta1 to 3.3LTS) causes errors on build custom project

Postby ESP_Angus » Mon Sep 09, 2019 1:28 am

Hi Al,
newsettler_AI wrote:
Sun Sep 08, 2019 2:43 pm
Not sure why this happens, since on beta version idf with same includes everything compiles and all "bt_icon" , "battery" ect stuff was find properly :shock:
It's hard to tell without knowing more about your project. Can you please give some details about what these variables are, how they are declared and where they are used, etc?

You shouldn't have to do this, but you can also try removing the "build" directory to force a 100% clean build.

newsettler_AI
Posts: 121
Joined: Wed Apr 05, 2017 12:49 pm

Re: Updating IDF (3.3beta1 to 3.3LTS) causes errors on build custom project

Postby newsettler_AI » Wed Sep 11, 2019 5:00 pm

Hi, Angus!
ESP_Angus wrote:
Mon Sep 09, 2019 1:28 am
You shouldn't have to do this, but you can also try removing the "build" directory to force a 100% clean build.
Tried, doesnt help, even tried to delete sdkconfig and recreated new one with make menuconfig. Same problems.

ESP_Angus wrote:
Mon Sep 09, 2019 1:28 am
It's hard to tell without knowing more about your project. Can you please give some details about what these variables are, how they are declared and where they are used, etc?
Ok, so my project structure (short view, I'm focused to show where is .mk files exist ):

Code: Select all

├───components
│   ├───mkspiffs
│   │   └───src
│   │       ├───spiffs
│   │       └───tclap
│   ├───spiffs
│   └───spiffs_image
│       └───image
│           ├───device
│           ├───history
│           └───settings
├───drv
│    component.mk
│    disp_spi.c
│    disp_spi.h
│    st7735b.c
│    st7735b.h
├───lvgl
│   │   component.mk
│   │   lvgl.h
│   ├───docs
│   ├───lv_core
│   ├───lv_draw
│   ├───lv_fonts
│   ├───lv_hal
│   ├───lv_misc
│   ├───lv_objx
│   ├───lv_porting
│   └───lv_themes
├───main
│   │   buttons.c
│   │   component.mk
│   │   history.c
│   │   Kconfig.projbuild
│   │   lcd.c
│   │   main.c
│   │   power.c
│   │   settings.c
│   │
│   ├───includes
│   │       buttons.h
│   │       history.h
│   │       hw_pins.h
│   │       lcd.h
│   │       pictures.h
│   │       power.h
│   │       settings.h
│   │
│   └───pictures
│           battery.c
│           bt_icon.c
│           component.mk
│           logo.c
│           meas_icon.c
│           time_icon.c
variables that doesnt compile declared with next macro:

Code: Select all

#define LV_IMG_DECLARE(var_name) extern const lv_img_dsc_t var_name;

. . .

LV_IMG_DECLARE(time_icon);

. . . 

It contains image bitmap with lib settings. Each image corresponds to same .c file at /main/pictures/ .
Example of time_icon.c:

Code: Select all

#include "lvgl/lvgl.h"

#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif

const LV_ATTRIBUTE_MEM_ALIGN uint8_t time_icon_map[] = {
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
  /*Pixel format: Red: 3 bit, Green: 3 bit, Blue: 2 bit*/
  0xff, 0xff, 0xff ...
#endif
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit*/
  0xff, 0xff, 0xff ...
#endif
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP != 0
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/
  0xff, 0xff, 0xff ...
#endif
#if LV_COLOR_DEPTH == 32
  /*Pixel format: Fix 0xFF: 8 bit, Red: 8 bit, Green: 8 bit, Blue: 8 bit*/
  0xff, 0xff, 0xff ...
#endif
};

lv_img_dsc_t time_icon = {
  .header.always_zero = 0,
  .header.w = 20,
  .header.h = 20,
  .data_size = 400 * LV_COLOR_SIZE / 8,
  .header.cf = LV_IMG_CF_TRUE_COLOR,
  .data = time_icon_map,
};
So I want to keep all image declarations at /main/includes/pictures.h

My pictures.h looks like next:

Code: Select all

#ifndef __PICTURES_H__
#define __PICTURES_H__

// LOGO
LV_IMG_DECLARE(logo);

// BT ICON
LV_IMG_DECLARE(bt_icon);

//TIME ICON
LV_IMG_DECLARE(time_icon);

// MEAS ICON
LV_IMG_DECLARE(meas_icon);

// BATTERY
LV_IMG_DECLARE(battery);

#endif /* __PICTURES_H__ */
And at /main/lcd.c I'm just included

Code: Select all

#include "includes/pictures.h"
And at 3.3beta1 IDF its works fine.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Updating IDF (3.3beta1 to 3.3LTS) causes errors on build custom project

Postby ESP_Angus » Thu Sep 12, 2019 8:38 am

Thanks for all the details.

If you run the "make list-components" target for the project, do you see all the components?

Some bugs were fixed in the build system where it was incorrectly including components that it shouldn't have according to the documented configuration variables, so it's possible you were inadvertently benefiting from this. If so, setting the EXTRA_COMPONENT_DIRS variable in your project should be able to make it work on both the old and new IDF versions.

newsettler_AI
Posts: 121
Joined: Wed Apr 05, 2017 12:49 pm

Re: Updating IDF (3.3beta1 to 3.3LTS) causes errors on build custom project

Postby newsettler_AI » Thu Sep 12, 2019 4:34 pm

ESP_Angus wrote:
Thu Sep 12, 2019 8:38 am
If so, setting the EXTRA_COMPONENT_DIRS variable in your project should be able to make it work on both the old and new IDF versions.
Thanks a lot, thats helped!

I have added folder with .c pictures bitmaps (main/pictures) to /Makefile:

Code: Select all

EXTRA_COMPONENT_DIRS := $(abspath drv)  $(abspath lvgl)  $(abspath main/pictures)
And now project builds properly :)

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: [Solved]Updating IDF (3.3beta1 to 3.3LTS) causes errors on build custom project

Postby ESP_Angus » Fri Sep 13, 2019 12:56 am

Hi Al,

Glad that sorted it out!

Angus

Who is online

Users browsing this forum: Baidu [Spider] and 158 guests