How to use test_sd.c

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

How to use test_sd.c

Postby mattismyo » Tue Aug 15, 2017 4:42 pm

How can i use test_sd.c to check my sd card?
https://github.com/espressif/esp-idf/bl ... /test_sd.c

When i try to compile the program, i get the message

C:/msys32/home/esp/esp-idf/components/sdmmc/test/build/esp32\libesp32.a(cpu_start.o):(.literal.main_task+0xc): undefined reference to `app_main'
C:/msys32/home/esp/esp-idf/components/sdmmc/test/build/esp32\libesp32.a(cpu_start.o): In function `main_task':
C:/msys32/home/esp/esp-idf/components/esp32/cpu_start.c:348: undefined reference to `app_main'
collect2.exe: error: ld returned 1 exit status
make: *** [C:/msys32/home/esp/esp-idf//make/project.mk:330: /home/esp/esp-idf/components/sdmmc/test/build/test_sd.c.elf] Fehler 1


I can't see a app_main in this script?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: How to use test_sd.c

Postby WiFive » Tue Aug 15, 2017 6:09 pm


mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Re: How to use test_sd.c

Postby mattismyo » Tue Aug 15, 2017 7:40 pm

Sorry for being dull. But i'm at step 'Building unit test app'.
I'm in the directory "test".


make menuconfig - configure unit test app.
>> there is nothing in make menuconfig to configure (also there is no Kconfig.projbuild, so its ok i think)

make TESTS_ALL=1 - build unit test app with tests for each component having tests in the test subdirectory.
>>
CC trax.o
CC eri.o
AR libxtensa-debug-module.a
LD test_sd.c.elf
C:/msys32/home/esp/esp-idf/components/sdmmc/test/build/esp32\libesp32.a(cpu_start.o):(.literal.main_task+0xc): undefined reference to `app_main'
C:/msys32/home/esp/esp-idf/components/sdmmc/test/build/esp32\libesp32.a(cpu_start.o): In function `main_task':
C:/msys32/home/esp/esp-idf/components/esp32/cpu_start.c:348: undefined reference to `app_main'
collect2.exe: error: ld returned 1 exit status
make: *** [C:/msys32/home/esp/esp-idf//make/project.mk:330: /home/esp/esp-idf/components/sdmmc/test/build/test_sd.c.elf] Fehler 1
I tried 'make flash TESTS_ALL=1'
>>
$ make flash TESTS_ALL=1
not linking libsodium tests, use 'TEST_COMPONENTS=libsodium' to test it
CC test_trace.o
C:/msys32/home/esp/esp-idf/components/app_trace/test/test_trace.c:6:19: fatal error: unity.h: No such file or directory
compilation terminated.
make[1]: *** [/home/esp/esp-idf/make/component_wrapper.mk:229: test_trace.o] Fehler 1
make: *** [C:/msys32/home/esp/esp-idf//make/project.mk:392: component-app_trace_test-build] Fehler 2
And well, yes, i've got no unity.h file

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: How to use test_sd.c

Postby WiFive » Wed Aug 16, 2017 12:16 am


ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: How to use test_sd.c

Postby ESP_igrr » Wed Aug 16, 2017 4:06 am

That should work:

Code: Select all

cd $IDF_PATH/tools/unit-test-app/
make defconfig
make flash monitor TEST_COMPONENTS=sdmmc ESPPORT=/dev/ttyUSB0
(replace /dev/ttyUSB0 with your port name)

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Re: How to use test_sd.c

Postby mattismyo » Wed Aug 16, 2017 7:15 am

Problem at step

Code: Select all

make flash monitor TEST_COMPONENTS=sdmmc ESPPORT=com3
Leaving...
Hard resetting...
MONITOR
--- idf_monitor on com3 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:4124
load:0x40078000,len:0
load:0x40078000,len:11968
entry 0x40078cd8
E (48) esp_image: image at 0x150000 has invalid magic byte
W (49) esp_image: image at 0x150000 has invalid SPI mode 255
W (68) esp_image: image at 0x150000 has invalid SPI size 15
E (126) boot: Failed to verify app image @ 0x150000 (8194)
user code done
Already tried 'make clean' before.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: How to use test_sd.c

Postby ESP_igrr » Wed Aug 16, 2017 8:53 am

Pullup on GPIO12 setting VDD_SDIO voltage to 1.8V, while flash chip is 3.3V part? Please read readme document in example/storage/sd_card.

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Re: How to use test_sd.c

Postby mattismyo » Wed Aug 16, 2017 9:34 am

I only want to test the 1-line mode, not the 4-line mode, so GPIO12 is not used.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: How to use test_sd.c

Postby ESP_igrr » Wed Aug 16, 2017 11:04 am

Are you able to program any other examples successfully using 'make flash monitor'? The output you see indicates that either flash programming or reading data from flash was not successful. Is it possible that you have something connected to the pins used for SPI flash (SD_xx pins)?

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Re: How to use test_sd.c

Postby mattismyo » Wed Aug 16, 2017 12:40 pm

Yes, i use some of those pins. But i never had problems by flashing other programs with this circuit.

IO23 and IO19. Is IO14 also with SDCLK one of those pins? I use this also this one.
I disconnected all cables on my ESP32 board, but it's still the same issue. Never saw this message while flashing other programs.

Who is online

Users browsing this forum: No registered users and 84 guests