whitecatboard / Lua-RTOS-ESP32

Lua RTOS for ESP32
Other
1.2k stars 221 forks source link

Latest version (703abe1) errors when building CAN.c #29

Closed jcwren closed 7 years ago

jcwren commented 7 years ago

Pulled a fresh copy of esp-idf, xtensa-esp32-elf, Lua-RTOS-ESP32. Changed board to ESP32 THING, no other modifications to configuration. Fails when building CAN.c. Configuration at sdkconfig.txt

$ make
cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE   -c -o mconf.o mconf.c
flex -L -P zconf -o zconf.lex.c zconf.l
zconf.l:255: warning, -s option given but default rule can be matched
bison -t -l -p zconf -o zconf.tab.c zconf.y
sed -E "s/\\x0D$//" zconf.gperf | gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$' -p -t
cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE   -c -o zconf.tab.o zconf.tab.c
lxdialog/check-lxdialog.sh -check cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE -lncurses 
cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE   -c -o lxdialog/checklist.o lxdialog/checklist.c
cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE   -c -o lxdialog/util.o lxdialog/util.c
cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE   -c -o lxdialog/inputbox.o lxdialog/inputbox.c
cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE   -c -o lxdialog/textbox.o lxdialog/textbox.c
cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE   -c -o lxdialog/yesno.o lxdialog/yesno.c
cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE   -c -o lxdialog/menubox.o lxdialog/menubox.c
cc -o mconf mconf.o zconf.tab.o lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o -lncurses 
cc  -DCURSES_LOC="<curses.h>" -DKBUILD_NO_NLS -Wno-format-security  -DLOCALE   -c -o conf.o conf.c
cc -o conf conf.o  zconf.tab.o -lncurses 
GENCONFIG
Configure esp-idf ...
Configure esp-idf for Lua RTOS ...
patching file /Users/jcw/Projects/esp-idf/components/lwip/api/api_msg.c
Hunk #1 succeeded at 875 (offset 6 lines).
patching file /Users/jcw/Projects/esp-idf/components/vfs/include/sys/dirent.h
patching file /Users/jcw/Projects/esp-idf/components/spi_flash/flash_ops.c
Hunk #1 succeeded at 486 with fuzz 1 (offset 7 lines).
patching file /Users/jcw/Projects/esp-idf/components/spi_flash/include/esp_spi_flash.h
Hunk #1 succeeded at 347 (offset 42 lines).
patching file components/esp32/event_default_handlers.c
patching file components/esp32/include/esp_event.h
patching file components/esp32/include/esp_interface.h
patching file components/tcpip_adapter/include/tcpip_adapter.h
patching file components/tcpip_adapter/tcpip_adapter_lwip.c
Hunk #3 succeeded at 110 (offset 1 line).
Hunk #4 succeeded at 178 (offset 1 line).
Hunk #5 succeeded at 207 (offset 1 line).
Hunk #6 succeeded at 242 (offset 1 line).
Hunk #7 succeeded at 265 (offset 1 line).
Hunk #8 succeeded at 326 (offset 1 line).
Hunk #9 succeeded at 341 (offset 1 line).
Hunk #10 succeeded at 443 (offset 1 line).
Hunk #11 succeeded at 461 (offset 1 line).
Hunk #12 succeeded at 664 (offset 1 line).
Hunk #13 succeeded at 675 (offset 1 line).
Hunk #14 succeeded at 694 (offset 1 line).
Hunk #15 succeeded at 721 (offset 1 line).
Hunk #16 succeeded at 845 (offset 1 line).
Configure esp-idf for Lua RTOS tests ...
CC src/bootloader_flash.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC src/bootloader_random.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC src/efuse.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC src/esp_image_format.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC src/flash_encrypt.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC src/flash_partitions.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC src/secure_boot.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC src/secure_boot_signatures.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
AR libbootloader_support.a
CC log.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
AR liblog.a
CC spi_flash_rom_patch.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
AR libspi_flash.a
CC micro-ecc/uECC.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
AR libmicro-ecc.a
CC esp32/brownout.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC esp32/cpu_util.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC esp32/rtc_clk.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC esp32/rtc_init.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC esp32/rtc_pm.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC esp32/rtc_sleep.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC esp32/rtc_time.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
AR libsoc.a
CC bootloader_start.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
CC flash_qio_mode.o
<command-line>:0:0: warning: "IDF_VER" redefined
<command-line>:0:0: note: this is the location of the previous definition
AR libmain.a
LD bootloader.elf
esptool.py v2.0-beta3
Building partitions from /Users/jcw/Projects/esp-idf/components/partition_table/partitions_singleapp.csv...
CC esp_ota_ops.o
AR libapp_update.a
CC src/bootloader_flash.o
CC src/bootloader_random.o
CC src/efuse.o
CC src/esp_image_format.o
CC src/flash_encrypt.o
CC src/flash_partitions.o
CC src/secure_boot.o
CC src/secure_boot_signatures.o
AR libbootloader_support.a
CC bt.o
AR libbt.a
CC CAN.o
In file included from /Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:20:0,
                 from /Users/jcw/Projects/esp-idf/components/esp32/include/rom/ets_sys.h:21,
                 from /Users/jcw/Projects/esp-idf/components/freertos/include/freertos/FreeRTOSConfig.h:108,
                 from /Users/jcw/Projects/esp-idf/components/freertos/include/freertos/FreeRTOS.h:99,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/include/CAN_config.h:32,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/include/CAN.h:33,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:30:
/Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c: In function 'CAN_init':
/Users/jcw/Projects/esp-idf/components/esp32/include/esp_assert.h:23:13: error: static assertion failed: "(Cannot use SET_PERI_REG_MASK for DPORT registers use DPORT_SET_PERI_REG_MASK)"
             _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);   \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:138:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
 #define ASSERT_IF_DPORT_REG(_r, OP)  TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
                                      ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:229:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
             ASSERT_IF_DPORT_REG((reg), SET_PERI_REG_MASK);                                                             \
             ^
/Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:147:5: note: in expansion of macro 'SET_PERI_REG_MASK'
     SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN);
     ^
/Users/jcw/Projects/esp-idf/components/esp32/include/esp_assert.h:23:13: error: static assertion failed: "(Cannot use WRITE_PERI_REG for DPORT registers use DPORT_WRITE_PERI_REG)"
             _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);   \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:138:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
 #define ASSERT_IF_DPORT_REG(_r, OP)  TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
                                      ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:217:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
             ASSERT_IF_DPORT_REG((addr), WRITE_PERI_REG);                                                               \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:230:13: note: in expansion of macro 'WRITE_PERI_REG'
             WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|(mask)));                                                        \
             ^
/Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:147:5: note: in expansion of macro 'SET_PERI_REG_MASK'
     SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN);
     ^
In file included from /Users/jcw/Projects/esp-idf/components/esp32/include/rom/ets_sys.h:21:0,
                 from /Users/jcw/Projects/esp-idf/components/freertos/include/freertos/FreeRTOSConfig.h:108,
                 from /Users/jcw/Projects/esp-idf/components/freertos/include/freertos/FreeRTOS.h:99,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/include/CAN_config.h:32,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/include/CAN.h:33,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:30:
/Users/jcw/Projects/esp-idf/components/esp32/include/esp_assert.h:23:13: error: static assertion failed: "(Cannot use READ_PERI_REG for DPORT registers use DPORT_READ_PERI_REG)"
             _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);   \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:218:76: note: in definition of macro 'WRITE_PERI_REG'
             (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val);                                       \
                                                                            ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:138:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
 #define ASSERT_IF_DPORT_REG(_r, OP)  TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
                                      ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:211:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
             ASSERT_IF_DPORT_REG((addr), READ_PERI_REG);                                                                \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:230:36: note: in expansion of macro 'READ_PERI_REG'
             WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|(mask)));                                                        \
                                    ^
/Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:147:5: note: in expansion of macro 'SET_PERI_REG_MASK'
     SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN);
     ^
In file included from /Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:20:0,
                 from /Users/jcw/Projects/esp-idf/components/esp32/include/rom/ets_sys.h:21,
                 from /Users/jcw/Projects/esp-idf/components/freertos/include/freertos/FreeRTOSConfig.h:108,
                 from /Users/jcw/Projects/esp-idf/components/freertos/include/freertos/FreeRTOS.h:99,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/include/CAN_config.h:32,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/include/CAN.h:33,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:30:
/Users/jcw/Projects/esp-idf/components/esp32/include/esp_assert.h:23:13: error: static assertion failed: "(Cannot use CLEAR_PERI_REG_MASK for DPORT registers use DPORT_CLEAR_PERI_REG_MASK)"
             _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);   \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:138:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
 #define ASSERT_IF_DPORT_REG(_r, OP)  TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
                                      ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:223:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
             ASSERT_IF_DPORT_REG((reg), CLEAR_PERI_REG_MASK);                                                           \
             ^
/Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:148:5: note: in expansion of macro 'CLEAR_PERI_REG_MASK'
     CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST);
     ^
/Users/jcw/Projects/esp-idf/components/esp32/include/esp_assert.h:23:13: error: static assertion failed: "(Cannot use WRITE_PERI_REG for DPORT registers use DPORT_WRITE_PERI_REG)"
             _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);   \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:138:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
 #define ASSERT_IF_DPORT_REG(_r, OP)  TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
                                      ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:217:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
             ASSERT_IF_DPORT_REG((addr), WRITE_PERI_REG);                                                               \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:224:13: note: in expansion of macro 'WRITE_PERI_REG'
             WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&(~(mask))));                                                     \
             ^
/Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:148:5: note: in expansion of macro 'CLEAR_PERI_REG_MASK'
     CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST);
     ^
In file included from /Users/jcw/Projects/esp-idf/components/esp32/include/rom/ets_sys.h:21:0,
                 from /Users/jcw/Projects/esp-idf/components/freertos/include/freertos/FreeRTOSConfig.h:108,
                 from /Users/jcw/Projects/esp-idf/components/freertos/include/freertos/FreeRTOS.h:99,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/include/CAN_config.h:32,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/include/CAN.h:33,
                 from /Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:30:
/Users/jcw/Projects/esp-idf/components/esp32/include/esp_assert.h:23:13: error: static assertion failed: "(Cannot use READ_PERI_REG for DPORT registers use DPORT_READ_PERI_REG)"
             _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);   \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:218:76: note: in definition of macro 'WRITE_PERI_REG'
             (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val);                                       \
                                                                            ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:138:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
 #define ASSERT_IF_DPORT_REG(_r, OP)  TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
                                      ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:211:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
             ASSERT_IF_DPORT_REG((addr), READ_PERI_REG);                                                                \
             ^
/Users/jcw/Projects/esp-idf/components/soc/esp32/include/soc/soc.h:224:36: note: in expansion of macro 'READ_PERI_REG'
             WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&(~(mask))));                                                     \
                                    ^
/Users/jcw/Projects/Lua-RTOS-ESP32/components/can/./CAN.c:148:5: note: in expansion of macro 'CLEAR_PERI_REG_MASK'
     CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST);
     ^
make[1]: *** [CAN.o] Error 1
make: *** [can-build] Error 2
$

Compiler version:

$ xtensa-esp32-elf-gcc -v
Using built-in specs.
COLLECT_GCC=xtensa-esp32-elf-gcc
COLLECT_LTO_WRAPPER=/Users/jcw/Projects/xtensa-esp32-elf/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/lto-wrapper
Target: xtensa-esp32-elf
Configured with: /Users/ivan/e/ESPTools/crosstool-NG/.build/src/gcc-5.2.0/configure --build=x86_64-build_apple-darwin16.0.0 --host=x86_64-build_apple-darwin16.0.0 --target=xtensa-esp32-elf --prefix=/Users/ivan/e/ESPTools/crosstool-NG/builds/xtensa-esp32-elf --with-local-prefix=/Users/ivan/e/ESPTools/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/sysroot --with-sysroot=/Users/ivan/e/ESPTools/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/sysroot --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG crosstool-ng-1.22.0-61-gab8375a' --disable-__cxa_atexit --enable-cxx-flags='-fno-exceptions -fno-rtti' --with-gmp=/Users/ivan/e/ESPTools/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-mpfr=/Users/ivan/e/ESPTools/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-mpc=/Users/ivan/e/ESPTools/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-isl=/Users/ivan/e/ESPTools/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-cloog=/Users/ivan/e/ESPTools/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-libelf=/Users/ivan/e/ESPTools/crosstool-NG/.build/xtensa-esp32-elf/buildtools --enable-lto --enable-target-optspace --without-long-double-128 --disable-libgomp --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-nls --disable-multilib --enable-languages=c,c++ --disable-libstdcxx-verbose
Thread model: single
gcc version 5.2.0 (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 
$
jolivepetrus commented 7 years ago

Yes, fails in all platforms and supported boards, due to a recent esp-idf update. We are working on it.

jolivepetrus commented 7 years ago

This build error is caused by esp-idf commit https://github.com/espressif/esp-idf/commit/f7e88565208451a7c3415be3a2b94d32377441f6#diff-0e0de619292959fa4d943440d4a6f161.

jolivepetrus commented 7 years ago

Please, try with this commit: https://github.com/whitecatboard/Lua-RTOS-ESP32/commit/f98b7cd337e36b9e9708496d314936a210ceee96

After changes CAN driver builds without any problem.

Tested on Mac OSX.

I can't test now with CAN hardware, but changes are only related to enable / disable hardware CAN module with new macros proposed by Espressif.

jcwren commented 7 years ago

Excellent, I am also able to build without errors. I have no way to test the actual CAN functionality, but I was unable to build regardless if CAN was enabled or disabled via 'make menuconfig'. Thanks!