Page 2 of 2

Re: STM32F105 clock configuration

Posted: Thu Jan 19, 2017 3:05 pm
by omcdr
I have taken to new project all files from:
c:\ChibiStudio\chibios161\testhal\STM32\STM32F1xx\USB_CDC_F107>


Only one modification is in Makefile for workspace161
CHIBIOS = ../../chibios161


Makefile looks like
PROJECT = ch

# Imported source files and paths
CHIBIOS = ../../chibios161
# Startup files.
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform.mk
include $(CHIBIOS)/os/hal/boards/OLIMEX_STM32_P107/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
#include $(CHIBIOS)/test/rt/test.mk

# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F103xB.ld


There are a lot of errors

#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/src/serial_usb.c:25:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/src/serial_usb.c:25:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.c:25:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.c:25:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
In file included from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.h:190:0,
from ../../chibios161/os/hal/include/hal.h:32,
from ../../chibios161/os/hal/ports/STM32/LLD/TIMv1/st_lld.c:25:
../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:359:2: error: #error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
#error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
^
make: *** [build/obj/hal.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [build/obj/st.o] Error 1
make: *** [build/obj/hal_buffers.o] Error 1
make: *** [build/obj/hal_queues.o] Error 1
make: *** [build/obj/hal_mmcsd.o] Error 1
make: *** [build/obj/pal.o] Error 1
make: *** [build/obj/serial_usb.o] Error 1
make: *** [build/obj/usb.o] Error 1
make: *** [build/obj/nvic.o] Error 1
make: *** [build/obj/hal_lld.o] Error 1
make: *** [build/obj/stm32_dma.o] Error 1
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/ports/STM32/LLD/TIMv1/st_lld.c:25:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/ports/STM32/LLD/TIMv1/st_lld.c:25:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
make: *** [build/obj/st_lld.o] Error 1
In file included from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.h:190:0,
from ../../chibios161/os/hal/include/hal.h:32,
from ../../chibios161/os/hal/ports/STM32/LLD/GPIOv1/pal_lld.c:25:
../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:359:2: error: #error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
#error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
^
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/ports/STM32/LLD/GPIOv1/pal_lld.c:25:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/ports/STM32/LLD/GPIOv1/pal_lld.c:25:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
make: *** [build/obj/pal_lld.o] Error 1
In file included from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.h:190:0,
from ../../chibios161/os/hal/include/hal.h:32,
from ../../chibios161/os/hal/boards/OLIMEX_STM32_P107/board.c:17:
../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:359:2: error: #error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
#error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
^
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/boards/OLIMEX_STM32_P107/board.c:17:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/boards/OLIMEX_STM32_P107/board.c:17:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
make: *** [build/obj/board.o] Error 1
In file included from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.h:190:0,
from ../../chibios161/os/hal/include/hal.h:32,
from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:27:
../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:359:2: error: #error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
#error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
^
In file included from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.h:190:0,
from ../../chibios161/os/hal/include/hal.h:32,
from ../../chibios161/os/hal/lib/streams/chprintf.c:30:
../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:359:2: error: #error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
#error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
^
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:27:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:27:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
In file included from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.h:190:0,
from ../../chibios161/os/hal/include/hal.h:32,
from ../../chibios161/os/hal/lib/streams/memstreams.c:27:
../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:359:2: error: #error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
#error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/lib/streams/chprintf.c:30:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
In file included from ../../chibios161/os/rt/include/ch.h:75:0,
from ../../chibios161/os/hal/osal/rt/osal.h:32,
from ../../chibios161/os/hal/include/hal.h:28,
from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:27:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c: In function 'usb_pm_alloc':
In file included from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.h:190:0,
from ../../chibios161/os/hal/include/hal.h:32,
from ../../chibios161/os/various/shell.c:28:
../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:359:2: error: #error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
#error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
^
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/lib/streams/chprintf.c:30:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:116:33: error: 'STM32_USB_PMA_SIZE' undeclared (first use in this function)
osalDbgAssert(usbp->pmnext <= STM32_USB_PMA_SIZE, "PMA overflow");
^
../../chibios161/os/rt/include/chdebug.h:196:11: note: in definition of macro 'chDbgAssert'
if (!(c)) { \
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:116:3: note: in expansion of macro 'osalDbgAssert'
osalDbgAssert(usbp->pmnext <= STM32_USB_PMA_SIZE, "PMA overflow");
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:116:33: note: each undeclared identifier is reported only once for each function it appears in
osalDbgAssert(usbp->pmnext <= STM32_USB_PMA_SIZE, "PMA overflow");
^
../../chibios161/os/rt/include/chdebug.h:196:11: note: in definition of macro 'chDbgAssert'
if (!(c)) { \
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:116:3: note: in expansion of macro 'osalDbgAssert'
osalDbgAssert(usbp->pmnext <= STM32_USB_PMA_SIZE, "PMA overflow");
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c: In function 'usb_lld_init':
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:463:18: error: 'USBD1' undeclared (first use in this function)
usbObjectInit(&USBD1);
^
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/lib/streams/memstreams.c:27:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c: At top level:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.c:289:13: warning: 'usb_serve_endpoints' defined but not used [-Wunused-function]
static void usb_serve_endpoints(USBDriver *usbp, uint32_t ep) {
^
In file included from ../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld.h:190:0,
from ../../chibios161/os/hal/include/hal.h:32,
from main.c:21:
../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:359:2: error: #error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
#error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"
^
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/various/shell.c:28:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/hal/lib/streams/memstreams.c:27:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
make: *** [build/obj/chprintf.o] Error 1
make: *** [build/obj/usb_lld.o] Error 1
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from ../../chibios161/os/various/shell.c:28:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
make: *** [build/obj/memstreams.o] Error 1
In file included from ../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:30:0,
from ../../chibios161/os/hal/include/usb.h:370,
from ../../chibios161/os/hal/include/hal.h:63,
from main.c:21:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:39:5: warning: "STM32_USB_ACCESS_SCHEME_2x16" is not defined [-Wundef]
#if STM32_USB_ACCESS_SCHEME_2x16
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h:81:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR
^
In file included from ../../chibios161/os/hal/include/usb.h:370:0,
from ../../chibios161/os/hal/include/hal.h:63,
from main.c:21:
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:117:2: error: #error "USB driver activated but no USB peripheral assigned"
#error "USB driver activated but no USB peripheral assigned"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:131:5: warning: "STM32_USBCLK" is not defined [-Wundef]
#if STM32_USBCLK != 48000000
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:132:2: error: #error "the USB driver requires a 48MHz clock"
#error "the USB driver requires a 48MHz clock"
^
../../chibios161/os/hal/ports/STM32/LLD/USBv1/usb_lld.h:421:5: warning: "STM32_USB_HAS_BCDR" is not defined [-Wundef]
#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__)
^
make: *** [build/obj/shell.o] Error 1
main.c: In function 'usb_event':
main.c:288:5: warning: implicit declaration of function 'chSysLockFromIsr' [-Wimplicit-function-declaration]
chSysLockFromIsr();
^
main.c:299:5: warning: implicit declaration of function 'chSysUnlockFromIsr' [-Wimplicit-function-declaration]
chSysUnlockFromIsr();
^
main.c:282:3: warning: enumeration value 'USB_EVENT_UNCONFIGURED' not handled in switch [-Wswitch]
switch (event) {
^
main.c: At top level:
main.c:325:4: error: 'USBD1' undeclared here (not in a function)
&USBD1,
^
main.c: In function 'cmd_threads':
main.c:353:34: error: 'THD_STATE_NAMES' undeclared (first use in this function)
static const char *states[] = {THD_STATE_NAMES};
^
main.c:353:34: note: each undeclared identifier is reported only once for each function it appears in
main.c:354:3: error: unknown type name 'Thread'
Thread *tp;
^
main.c:362:6: warning: assignment from incompatible pointer type
tp = chRegFirstThread();
^
main.c:365:39: error: request for member 'p_ctx' in something not a structure or union
(uint32_t)tp, (uint32_t)tp->p_ctx.r13,
^
main.c:365:46: error: request for member 'r13' in something not a structure or union
(uint32_t)tp, (uint32_t)tp->p_ctx.r13,
^
main.c:366:25: error: request for member 'p_prio' in something not a structure or union
(uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1),
^
main.c:366:48: error: request for member 'p_refs' in something not a structure or union
(uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1),
^
main.c:367:22: error: request for member 'p_state' in something not a structure or union
states[tp->p_state], (uint32_t)tp->p_time);
^
main.c:367:19: error: array subscript is not an integer
states[tp->p_state], (uint32_t)tp->p_time);
^
main.c:367:46: error: request for member 'p_time' in something not a structure or union
states[tp->p_state], (uint32_t)tp->p_time);
^
main.c:368:26: warning: passing argument 1 of 'chRegNextThread' from incompatible pointer type
tp = chRegNextThread(tp);
^
In file included from ../../chibios161/os/rt/include/ch.h:84:0,
from main.c:20:
../../chibios161/os/rt/include/chregistry.h:112:13: note: expected 'struct thread_t *' but argument is of type 'int *'
thread_t *chRegNextThread(thread_t *tp);
^
main.c:368:8: warning: assignment from incompatible pointer type
tp = chRegNextThread(tp);
^
main.c:353:22: warning: variable 'states' set but not used [-Wunused-but-set-variable]
static const char *states[] = {THD_STATE_NAMES};
^
main.c: In function 'cmd_test':
main.c:373:3: error: unknown type name 'Thread'
Thread *tp;
^
main.c:380:3: warning: implicit declaration of function 'THD_WA_SIZE' [-Wimplicit-function-declaration]
tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(),
^
main.c:380:3: warning: implicit declaration of function 'chThdGetPriority' [-Wimplicit-function-declaration]
main.c:381:28: error: 'TestThread' undeclared (first use in this function)
TestThread, chp);
^
main.c:381:28: warning: passing argument 4 of 'chThdCreateFromHeap' from incompatible pointer type
In file included from ../../chibios161/os/rt/include/ch.h:95:0,
from main.c:20:
../../chibios161/os/rt/include/chdynamic.h:77:13: note: expected 'tfunc_t' but argument is of type 'const char **'
thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,
^
main.c:380:6: warning: assignment from incompatible pointer type
tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(),
^
main.c:386:13: warning: passing argument 1 of 'chThdWait' from incompatible pointer type
chThdWait(tp);
^
In file included from ../../chibios161/os/rt/include/ch.h:81:0,
from main.c:20:
../../chibios161/os/rt/include/chthreads.h:157:9: note: expected 'struct thread_t *' but argument is of type 'int *'
msg_t chThdWait(thread_t *tp);
^
main.c: At top level:
main.c:440:32: error: expected ')' before numeric constant
static WORKING_AREA(waThread1, 128);
^
main.c: In function 'Thread1':
main.c:452:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
main.c: In function 'main':
main.c:458:3: error: unknown type name 'Thread'
Thread *shelltp = NULL;
^
main.c:481:3: warning: implicit declaration of function 'usb_lld_disconnect_bus' [-Wimplicit-function-declaration]
usbDisconnectBus(serusbcfg.usbp);
^
main.c:484:3: warning: implicit declaration of function 'usb_lld_connect_bus' [-Wimplicit-function-declaration]
usbConnectBus(serusbcfg.usbp);
^
main.c:494:21: error: 'waThread1' undeclared (first use in this function)
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
^
main.c:494:32: warning: passing argument 2 of 'chThdCreateStatic' makes integer from pointer without a cast
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
^
In file included from ../../chibios161/os/rt/include/ch.h:81:0,
from main.c:20:
../../chibios161/os/rt/include/chthreads.h:137:13: note: expected 'size_t' but argument is of type 'const char **'
thread_t *chThdCreateStatic(void *wsp, size_t size,
^
main.c:494:63: warning: passing argument 4 of 'chThdCreateStatic' from incompatible pointer type
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
^
In file included from ../../chibios161/os/rt/include/ch.h:81:0,
from main.c:20:
../../chibios161/os/rt/include/chthreads.h:137:13: note: expected 'tfunc_t' but argument is of type 'msg_t (*)(void *)'
thread_t *chThdCreateStatic(void *wsp, size_t size,
^
main.c:502:15: warning: assignment from incompatible pointer type
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
^
main.c:503:5: warning: implicit declaration of function 'chThdTerminated' [-Wimplicit-function-declaration]
else if (chThdTerminated(shelltp)) {
^
main.c:504:20: warning: passing argument 1 of 'chThdRelease' from incompatible pointer type
chThdRelease(shelltp); /* Recovers memory of the previous shell. */
^
In file included from ../../chibios161/os/rt/include/ch.h:95:0,
from main.c:20:
../../chibios161/os/rt/include/chdynamic.h:75:8: note: expected 'struct thread_t *' but argument is of type 'int *'
void chThdRelease(thread_t *tp);
^
make: *** [build/obj/main.o] Error 1

14:52:17 Build Finished (took 6s.941ms)




What I'm doing wrong ?

Re: STM32F105 clock configuration

Posted: Thu Jan 19, 2017 3:22 pm
by Giovanni
Giovanni wrote:Are you including the right platform mk file (platform_f105_f107.mk) from your Makefile?

Make sure to take all files from an F107 project.

Giovanni


This.

Giovanni wrote:The "undefined" errors are likely caused by an outdated halconf.h.

Please make sure to take ALL files from an F107 demo in the same VERSION you are using.

Giovanni


This.

LDSCRIPT= $(STARTUPLD)/STM32F103xB.ld


This

../../chibios161/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:359:2: error: #error "Using a wrong mcuconf.h file, STM32F107_MCUCONF not defined"


This.

Giovanni

Re: STM32F105 clock configuration

Posted: Thu Jan 19, 2017 3:42 pm
by RoccoMarco
Hi,
maybe this article could be helpful somehow.

Re: STM32F105 clock configuration

Posted: Thu Jan 19, 2017 6:57 pm
by omcdr
Here is my investigation.

changes:
include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform_f105_f107.mk
./OLIMEX_STM32_P107/board.mk
LDSCRIPT= $(STARTUPLD)/STM32F107xC.ld

#define STM32F107_MCUCONF in mcuconf.h



comment out many code in main.c it seems that THD_STATE_NAMES exist only in chibios26 headers.
main looks:

Code: Select all

int main(void) {
  halInit();
  chSysInit();
  chThdSleepMilliseconds(1000);
}


compilation with 25Mhz works, CubeMX accept this config Image


only change in board.h
#define STM32_HSECLK 8000000


compilation works, but CubeMX show error with 8MHz Image

My clock modification for 8MHz

Code: Select all

#define STM32_PREDIV1SRC                    STM32_PREDIV1SRC_HSE
#define STM32_PREDIV1_VALUE                 1
#define STM32_PLLMUL_VALUE                  9
#define STM32_PREDIV2_VALUE                 1
#define STM32_PLL2MUL_VALUE                 8
#define STM32_PLL3MUL_VALUE                 8
#define STM32_PPRE2                         STM32_PPRE2_DIV1
#define STM32_ADCPRE                        STM32_ADCPRE_DIV2


CubeMX accept my config Image

but compilation show erros
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:468:22: warning: "STM32_MCOSEL_PLL2DIV2" is not defined [-Wundef]
(STM32_MCOSEL == STM32_MCOSEL_PLL2DIV2) || \
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:557:2: error: #error "STM32_PLL2CLKIN outside acceptable range (STM32_PLL23IN_MIN...STM32_PLL23IN_MAX)"
#error "STM32_PLL2CLKIN outside acceptable range (STM32_PLL23IN_MIN...STM32_PLL23IN_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:573:2: error: #error "STM32_PLL2VCO outside acceptable range (STM32_PLL23VCO_MIN...STM32_PLL23VCO_MAX)"
#error "STM32_PLL2VCO outside acceptable range (STM32_PLL23VCO_MIN...STM32_PLL23VCO_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:584:2: error: #error "STM32_PLL3CLKIN outside acceptable range (STM32_PLL23IN_MIN...STM32_PLL23IN_MAX)"
#error "STM32_PLL3CLKIN outside acceptable range (STM32_PLL23IN_MIN...STM32_PLL23IN_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:600:2: error: #error "STM32_PLL3CLKOUT outside acceptable range (STM32_PLL23VCO_MIN...STM32_PLL23VCO_MAX)"
#error "STM32_PLL3CLKOUT outside acceptable range (STM32_PLL23VCO_MIN...STM32_PLL23VCO_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:627:2: error: #error "STM32_PLLCLKIN outside acceptable range (STM32_PLL1IN_MIN...STM32_PLL1IN_MAX)"
#error "STM32_PLLCLKIN outside acceptable range (STM32_PLL1IN_MIN...STM32_PLL1IN_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:642:2: error: #error "STM32_PLLVCO outside acceptable range (STM32_PLL1VCO_MIN...STM32_PLL1VCO_MAX)"
#error "STM32_PLLVCO outside acceptable range (STM32_PLL1VCO_MIN...STM32_PLL1VCO_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:660:2: error: #error "STM32_SYSCLK above maximum rated frequency (STM32_SYSCLK_MAX)"
#error "STM32_SYSCLK above maximum rated frequency (STM32_SYSCLK_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:690:2: error: #error "STM32_HCLK exceeding maximum frequency (STM32_SYSCLK_MAX)"
#error "STM32_HCLK exceeding maximum frequency (STM32_SYSCLK_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:712:2: error: #error "STM32_PCLK1 exceeding maximum frequency (STM32_PCLK1_MAX)"
#error "STM32_PCLK1 exceeding maximum frequency (STM32_PCLK1_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:734:2: error: #error "STM32_PCLK2 exceeding maximum frequency (STM32_PCLK2_MAX)"
#error "STM32_PCLK2 exceeding maximum frequency (STM32_PCLK2_MAX)"
^
../chibios/os/hal/ports/STM32/STM32F1xx/hal_lld_f105_f107.h:769:2: error: #error "STM32_ADCCLK exceeding maximum frequency (STM32_ADCCLK_MAX)"
#error "STM32_ADCCLK exceeding maximum frequency (STM32_ADCCLK_MAX)"



Is there a bug in clock configuration or calculation for STM32F105/107 ?

Here is my full project USB_CDC_F107.zip

Re: STM32F105 clock configuration

Posted: Fri Jan 20, 2017 7:29 am
by omcdr
There is error in hal_lld_f105_f107.h with definitions

#define STM32_PLL23VCO_MIN 80000000 - in CubeMx can be 64MHz

#define STM32_ADCCLK_MAX 14000000 - in CubeMx I have 32Mhz

Re: STM32F105 clock configuration

Posted: Fri Jan 20, 2017 9:17 am
by Giovanni
Hi,

The datasheet states:

fADC -> 0.6...14MHz
fVCO_OUT -> 80...148MHz

The HAL is implemented according to the ST latest datasheet, it is a bug in the manual or in CubeMX, we follow manuals for this kind of things.

If you want to go outside specification then edit hal_lld_f105_f107.h, the limits are defined there.

Giovanni

Re: STM32F105 clock configuration

Posted: Fri Jan 20, 2017 10:03 am
by omcdr
Ups, you are right.
It is official tool from ST...
I will report a bug.

Thank you for patience ;)