You should use configuration files taken from the version you are using, those change with the rest of the code. If there isn't the declaration in mcuconf.h then the various subsystems are all enabled by default.
Giovanni
I2C implementation for STM32
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: I2C implementation for STM32
The other errors are caused by the use of an old ch.ld linker script, you must use files from the same release, this includes source code, configuration files, makefiles and linker scripts. Linker scripts have been enhanced and are now centralized.
Configuration files: chconf.h, halconf.h, mcuconf.h.
Giovanni
Configuration files: chconf.h, halconf.h, mcuconf.h.
Giovanni
Re: I2C implementation for STM32
So, when I download a new release (/trunk), what are the stages to create a new project with eclipse ?
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: I2C implementation for STM32
You are working with development code so a good way is to read the change log and see if there is something changed. Usually you should always verify if the files in your project directory (makefile and config files) have been modified in the new version, if so then replace them with the new versions.
Note that compatibility can only be expected within a stable branch. Development branches are meant to be "unstable" and that not because the code crashes but mainly because it changes during development.
You may find useful a diff tool in order to assess if something changed, for example, I use the diff tool included in Tortoise SVN (TortoiseMerge), really handy.
Giovanni
Note that compatibility can only be expected within a stable branch. Development branches are meant to be "unstable" and that not because the code crashes but mainly because it changes during development.
You may find useful a diff tool in order to assess if something changed, for example, I use the diff tool included in Tortoise SVN (TortoiseMerge), really handy.
Giovanni
Re: I2C implementation for STM32
Ok,
So I create a new project. In the project directory I copy the following files from testhal\STM32F1xx\ADC current revision:
- chconf.h
- halconf.h
- mcuconf.h
I add also a makefile :
I create a simple test.c, I build and I have the following error:
So I create a new project. In the project directory I copy the following files from testhal\STM32F1xx\ADC current revision:
- chconf.h
- halconf.h
- mcuconf.h
I add also a makefile :
...
# Define linker script file here
LDSCRIPT= $(PORTLD)/STM32F103xE.ld #ch.ld
# Imported source files
CHIBIOS = ../
include $(CHIBIOS)/boards/OLIMEX_STM32_P103/board.mk
include $(CHIBIOS)/os/hal/platforms/STM32F1xx/platform.mk
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F1xx/port.mk
include $(CHIBIOS)/os/kernel/kernel.mk
...
I create a simple test.c, I build and I have the following error:
**** Build of configuration Default for project MP32-UAV ****
make all
arm-none-eabi-g++ ..//os/ports/GCC/ARMCMx/crt0.o ..//os/ports/GCC/ARMCMx/STM32F1xx/vectors.o ..//os/ports/GCC/ARMCMx/chcore.o ..//os/ports/GCC/ARMCMx/chcore_v7m.o ..//os/ports/GCC/ARMCMx/nvic.o ..//os/kernel/src/chsys.o ..//os/kernel/src/chdebug.o ..//os/kernel/src/chlists.o ..//os/kernel/src/chvt.o ..//os/kernel/src/chschd.o ..//os/kernel/src/chthreads.o ..//os/kernel/src/chdynamic.o ..//os/kernel/src/chregistry.o ..//os/kernel/src/chsem.o ..//os/kernel/src/chmtx.o ..//os/kernel/src/chcond.o ..//os/kernel/src/chevents.o ..//os/kernel/src/chmsg.o ..//os/kernel/src/chmboxes.o ..//os/kernel/src/chqueues.o ..//os/kernel/src/chmemcore.o ..//os/kernel/src/chheap.o ..//os/kernel/src/chmempools.o ..//os/hal/src/hal.o ..//os/hal/src/adc.o ..//os/hal/src/can.o ..//os/hal/src/ext.o ..//os/hal/src/gpt.o ..//os/hal/src/i2c.o ..//os/hal/src/icu.o ..//os/hal/src/mac.o ..//os/hal/src/pal.o ..//os/hal/src/pwm.o ..//os/hal/src/sdc.o ..//os/hal/src/serial.o ..//os/hal/src/spi.o ..//os/hal/src/uart.o ..//os/hal/src/usb.o ..//os/hal/src/mmc_spi.o ..//os/hal/src/serial_usb.o ..//os/hal/src/rtc.o ..//os/hal/platforms/STM32F1xx/hal_lld.o ..//os/hal/platforms/STM32F1xx/adc_lld.o ..//os/hal/platforms/STM32/can_lld.o ..//os/hal/platforms/STM32/ext_lld.o ..//os/hal/platforms/STM32/gpt_lld.o ..//os/hal/platforms/STM32/icu_lld.o ..//os/hal/platforms/STM32/i2c_lld.o ..//os/hal/platforms/STM32/mac_lld.o ..//os/hal/platforms/STM32/pwm_lld.o ..//os/hal/platforms/STM32/serial_lld.o ..//os/hal/platforms/STM32/sdc_lld.o ..//os/hal/platforms/STM32/spi_lld.o ..//os/hal/platforms/STM32/uart_lld.o ..//os/hal/platforms/STM32/GPIOv1/pal_lld.o ..//os/hal/platforms/STM32/DMAv1/stm32_dma.o ..//os/hal/platforms/STM32/USBv1/usb_lld.o ..//os/hal/platforms/STM32/RTCv1/rtc_lld.o ..//boards/MULTIPILOT32/board.o ..//os/various/evtimer.o ..//os/various/syscalls.o test.o -mcpu=cortex-m3 -nostartfiles -T..//os/ports/GCC/ARMCMx/STM32F1xx/ld/STM32F103xE.ld -Wl,-Map=./MP32_UAV.map,--cref,--no-warn-mismatch,--gc-sections -mno-thumb-interwork -mthumb -o MP32_UAV.elf
..//os/kernel/src/chschd.o: In function `chSchGoSleepS':
E:\Projet\UAV\Programmes\Sources\chibios\MP32-UAV/..//os/kernel/src/chschd.c:118: undefined reference to `THREAD_CONTEXT_SWITCH_HOOK'
..//os/kernel/src/chschd.o: In function `chSchWakeupS':
E:\Projet\UAV\Programmes\Sources\chibios\MP32-UAV/..//os/kernel/src/chschd.c:230: undefined reference to `THREAD_CONTEXT_SWITCH_HOOK'
..//os/kernel/src/chschd.o: In function `chSchDoReschedule':
E:\Projet\UAV\Programmes\Sources\chibios\MP32-UAV/..//os/kernel/src/chschd.c:302: undefined reference to `THREAD_CONTEXT_SWITCH_HOOK'
collect2: ld returned 1 exit status
make: *** [MP32_UAV.elf] Error 1
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: I2C implementation for STM32
THREAD_CONTEXT_SWITCH_HOOK() is defined in chconf.h, probably you didn't really update it.
Giovanni
Giovanni
Re: I2C implementation for STM32
In the trunk directory, in which directory can i find the update of chconf.h, halconf.h, mcuconf.h corresponding to my st32 platform ?
(when i made a file search, many halcon.h... appear)
(when i made a file search, many halcon.h... appear)
Last edited by Cyrille on Wed Oct 05, 2011 8:33 am, edited 1 time in total.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: I2C implementation for STM32
chconf.h and halconf.h are equal on all platforms, mcuconf.h is platform dependent and you can get it from a demo using your same MCU, in you case you may use the one in ./testhal/STM32F1xx/ADC.
Anyway, we are going off topic here, this thread is about I2C, please open a topic in the support forum.
Giovanni
Anyway, we are going off topic here, this thread is about I2C, please open a topic in the support forum.
Giovanni
Re: I2C implementation for STM32
I'm trying to add the I2C example to the STM3210E-EVAL (just using the temperature sensor which is the same LM75) and it fails with an ack error (then cashes when trying to raise the error event flag, but that's a different issue).
I changed the address to 0x90 which is the one in this board.
I changed the address to 0x90 which is the one in this board.