'BOARD_PHY_ID' undeclared

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
MrWadson
Posts: 4
Joined: Fri Jan 17, 2014 10:50 am

'BOARD_PHY_ID' undeclared

Post by MrWadson »

We are using ChibiStudio and STM32F407 Discovery board. An error occured when build the ARMCM4-STM32F407-LWIP project:
'BOARD_PHY_ID' undeclared (first use in this function) mac_lld.c /ARMCM4-STM32F407-LWIP/os/hal/platforms/STM32 line 129 C/C++ Problem
What's the matter?

A lot of Thanks.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: 'BOARD_PHY_ID' undeclared

Post by Giovanni »

Hi,

Which ChibiOS version are you using, the demo compiles here using 2.6.2.

Code: Select all

09:38:07 **** Build of configuration Default for project ARMCM4-STM32F407-LWIP ****
make -j2 all
Compiler Options
arm-none-eabi-gcc -c -mcpu=cortex-m4 -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -ffunction-sections -fdata-sections -fno-common -Wall -Wextra -Wstrict-prototypes -Wa,-alms=build/lst/ -DCORTEX_USE_FPU=FALSE -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -MD -MP -MF .dep/build.d -I. -I../../os/ports/common/ARMCMx/CMSIS/include -I../../os/ports/common/ARMCMx -I../../os/ports/GCC/ARMCMx -I../../os/ports/GCC/ARMCMx/STM32F4xx -I../../os/kernel/include -I../../test -I../../os/hal/include -I../../os/hal/platforms/STM32F4xx -I../../os/hal/platforms/STM32 -I../../os/hal/platforms/STM32/GPIOv2 -I../../os/hal/platforms/STM32/I2Cv1 -I../../os/hal/platforms/STM32/OTGv1 -I../../os/hal/platforms/STM32/RTCv2 -I../../os/hal/platforms/STM32/SPIv1 -I../../os/hal/platforms/STM32/TIMv1 -I../../os/hal/platforms/STM32/USARTv1 -I../../boards/OLIMEX_STM32_P407 -I../../os/various/lwip_bindings -I../../ext/lwip/src/include -I../../ext/lwip/src/include/ipv4 -I../../os/various main.c -o main.o

mkdir -p build/obj
mkdir -p build/lst
Compiling crt0.c
Compiling vectors.c
Compiling chcore_v7m.c
Compiling chcore.c
Compiling nvic.c
Compiling chsys.c
Compiling chdebug.c
Compiling chlists.c
Compiling chvt.c
Compiling chschd.c
Compiling chthreads.c
Compiling chdynamic.c
Compiling chregistry.c
Compiling chsem.c
Compiling chmtx.c
Compiling chcond.c
Compiling chevents.c
Compiling chmsg.c
Compiling chmboxes.c
Compiling chqueues.c
Compiling chmemcore.c
Compiling chheap.c
Compiling chmempools.c
Compiling test.c
Compiling testthd.c
Compiling testsem.c
Compiling testmtx.c
Compiling testmsg.c
Compiling testmbox.c
Compiling testevt.c
Compiling testheap.c
Compiling testpools.c
Compiling testdyn.c
Compiling testqueues.c
Compiling testbmk.c
Compiling hal.c
Compiling adc.c
Compiling can.c
Compiling dac.c
Compiling ext.c
Compiling gpt.c
Compiling i2c.c
Compiling icu.c
Compiling mac.c
Compiling mmc_spi.c
Compiling mmcsd.c
Compiling pal.c
Compiling pwm.c
Compiling rtc.c
Compiling sdc.c
Compiling serial.c
Compiling serial_usb.c
Compiling spi.c
Compiling tm.c
Compiling uart.c
Compiling usb.c
Compiling stm32_dma.c
Compiling hal_lld.c
Compiling adc_lld.c
Compiling ext_lld_isr.c
Compiling can_lld.c
Compiling ext_lld.c
Compiling mac_lld.c
Compiling sdc_lld.c
Compiling pal_lld.c
Compiling i2c_lld.c
Compiling usb_lld.c
Compiling rtc_lld.c
Compiling spi_lld.c
Compiling gpt_lld.c
Compiling icu_lld.c
Compiling pwm_lld.c
Compiling serial_lld.c
Compiling uart_lld.c
Compiling board.c
Compiling lwipthread.c
Compiling sys_arch.c
Compiling etharp.c
Compiling dhcp.c
Compiling dns.c
Compiling init.c
Compiling mem.c
Compiling memp.c
Compiling netif.c
Compiling pbuf.c
Compiling raw.c
Compiling stats.c
Compiling sys.c
Compiling tcp.c
Compiling tcp_in.c
Compiling tcp_out.c
Compiling udp.c
Compiling autoip.c
Compiling icmp.c
Compiling igmp.c
Compiling inet.c
Compiling inet_chksum.c
Compiling ip.c
Compiling ip_addr.c
Compiling ip_frag.c
Compiling def.c
Compiling timers.c
Compiling api_lib.c
Compiling api_msg.c
Compiling err.c
Compiling netbuf.c
Compiling netdb.c
Compiling netifapi.c
Compiling sockets.c
Compiling tcpip.c
Compiling evtimer.c
Compiling web.c
Compiling main.c
main.c: In function 'Thread1':
main.c:39:1: warning: no return statement in function returning non-void [-Wreturn-type]
Linking build/ch.elf
Creating build/ch.hex
Creating build/ch.bin
Creating build/ch.dmp
Done

09:38:36 Build Finished (took 28s.203ms)


Giovanni
MrWadson
Posts: 4
Joined: Fri Jan 17, 2014 10:50 am

Re: 'BOARD_PHY_ID' undeclared

Post by MrWadson »

Chibios version 2.6.1.
Why are you using OLIMEX_STM32_P407 in your code for STM32F4-Discovery?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: 'BOARD_PHY_ID' undeclared

Post by Giovanni »

That demo is meant for OLIMEX_STM32_P407.

The discovery board does not have a PHY, this is why it is undefined. If you want to attach a PHY to the discovery then you need to define that macro in board.h.

Giovanni
MrWadson
Posts: 4
Joined: Fri Jan 17, 2014 10:50 am

Re: 'BOARD_PHY_ID' undeclared

Post by MrWadson »

Ok, i am declared the BOARD_PHY_ID variable and project built successfull. Also, i'm redefined this two declaration:

Code: Select all

#define GPIOC_SWITCH_TAMPER         GPIOC_PIN13
#define GPIOF_STAT1                 GPIOF_PIN6

But after run Open On-Chip Debugger i got the following messages in Console:
Open On-Chip Debugger 0.7.0 (2013-05-05-10:41)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.925089
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection from 3333
Info : stm32f4x errata detected - fixing incorrect MCU_IDCODE
Info : device id = 0x10006413
Info : flash size = 1024kbytes
Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000240 msp: 0x20000400
Info : Padding image section 0 with 8 bytes
Info : halted: PC: 0x08000192
Info : halted: PC: 0x08000194
Info : halted: PC: 0x08000196
Info : halted: PC: 0x08006090

And after click on pause I get to the next function:

Code: Select all

void port_halt(void) {

  port_disable();
  while (TRUE) {
  }
}

What could be wrong?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: 'BOARD_PHY_ID' undeclared

Post by Giovanni »

The discovery board does not has a PHY so its default settings for pins must be adjusted, it is done in board.h.

If you search on the forum, board files for discovery + external PHY have already been contributed, search the relevant discussions.

Giovanni
MrWadson
Posts: 4
Joined: Fri Jan 17, 2014 10:50 am

Re: 'BOARD_PHY_ID' undeclared

Post by MrWadson »

I do not have external PHY adapter, but I have ENC28J60 (SPI to Ethernet). Can i used it in ARMCM4-STM32F407-LWIP DEMO?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: 'BOARD_PHY_ID' undeclared

Post by Giovanni »

You would have to implement from scratch a MAC driver for ENC28J60 through the SPI driver. The demo uses the Ethernet peripheral internal to the STM32.

Not an easy task.

Giovanni
Post Reply