cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with stdperiph_lib

janvi
Associate II
Posted on November 02, 2009 at 12:09

Trouble with stdperiph_lib

7 REPLIES 7
tomas23
Associate II
Posted on May 17, 2011 at 13:26

The usage of the library: copy, open template project, add or remove peripheral drivers, (un)link them in stm32f10x_conf.h.

Btw. the balast for different ST eval boards is nice for demos, but useless for customer ones.

The basic template is compilable without changes, you should start from this and keep the directory structure.

Concerning the errors:

Selected processor doesn't support... - change the compiler version?

The rest looks like you removed link to some header file from the other header files, and now it misses the declarations. Try to start from the beginning, with basic library directory structure with a given template project.

I did download, unpack, copy and compile without errors within 5 minutes (well, using IAR, not Hitex).

janvi
Associate II
Posted on May 17, 2011 at 13:26

To start with a new micro within a few hours, I believed the CMSIS advertising, downloaded the latest STM32F10xStdPeriph_LibV3.1.2 and tried to compile the GPIOtoggle example. For Flash download I have a Hitex Hitop Tantino installed with GCC V4.3.3. Target Hardware is a Keil MCBSTM32 with F103RB medium densitiy device. Unfortunately it already took a few hours to copy all required source files into a source directory what now looks like this: (sorry your forum script dont shows tabs)

C:\data\jv\Toggle\Source>ls

core_cm3.c startup_stm32f10x_md.s stm32f10x_exti.h stm32f10x_usart.c

core_cm3.h stm3210b_eval.h stm32f10x_gpio.c stm32f10x_usart.h

interrupt.h stm32_eval.c stm32f10x_gpio.h system_stm32f10x.c

main.c stm32_eval.h stm32f10x_it.c system_stm32f10x.h

main.h stm32f10x.h stm32f10x_it.h

misc.c stm32f10x_conf.h stm32f10x_rcc.c

misc.h stm32f10x_exti.c stm32f10x_rcc.h

Like written in the Periph_Lib CHM instructions, I edited stm32_eval.c and select the ''B'' Eval Board what contains a F103VBT6 Medium Device similar to my Keil board. Further I edited stm32f10x.h to select medium density device. For a pin toggle, I now have about 17.000 lines of C source code inside 25 files! This is not what I expected from a more easy software design when I tried to compile:

arm-hitex-elf-gcc.exe -c -gdwarf-2 -MD -O0 -trigraphs -mcpu=cortex-m3 -mthumb -Wall -fsigned-char -mlittle-endian -mfpu=vfp -xc -mno-thumb-interwork -mno-tpcs-frame -I.\Source\ -o .\objects\core_cm3.o .\Source\core_cm3.c

/cygdrive/c/DOKUME~1/cad/LOKALE~1/Temp/ccXXSLdu.s: Assembler messages:

/cygdrive/c/DOKUME~1/cad/LOKALE~1/Temp/ccXXSLdu.s:694: Error: selected processor does not support `strex r3,r3,[r2]'

arm-hitex-elf-gcc.exe -c -gdwarf-2 -MD -O0 -trigraphs -mcpu=cortex-m3 -mthumb -Wall -fsigned-char -mlittle-endian -mfpu=vfp -xc -mno-thumb-interwork -mno-tpcs-frame -I.\Source\ -o .\objects\main.o .\Source\main.c

In file included from .\Source\main.c:23:

.\Source\/stm32_eval.h:138: error: expected declaration specifiers or '...' before 'USART_InitTypeDef'

.\Source\main.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'GPIO_InitStructure'

.\Source\main.c: In function 'main':

.\Source\main.c:58: warning: implicit declaration of function 'RCC_APB2PeriphClockCmd'

.\Source\main.c:58: error: 'RCC_APB2Periph_GPIOA' undeclared (first use in this function)

.\Source\main.c:58: error: (Each undeclared identifier is reported only once

.\Source\main.c:58: error: for each function it appears in.)

.\Source\main.c:58: error: 'RCC_APB2Periph_GPIOB' undeclared (first use in this function)

arm-hitex-elf-gcc.exe -c -gdwarf-2 -MD -O0 -trigraphs -mcpu=cortex-m3 -mthumb -Wall -fsigned-char -mlittle-endian -mfpu=vfp -xc -mno-thumb-interwork -mno-tpcs-frame -I.\Source\ -o .\objects\misc.o .\Source\misc.c

.\Source\misc.c: In function 'NVIC_PriorityGroupConfig':

.\Source\misc.c:98: warning: implicit declaration of function 'assert_param'

arm-hitex-elf-gcc.exe -c -gdwarf-2 -MD -O0 -trigraphs -mcpu=cortex-m3 -mthumb -Wall -fsigned-char -mlittle-endian -mfpu=vfp -xc -mno-thumb-interwork -mno-tpcs-frame -I.\Source\ -o .\objects\stm32_eval.o .\Source\stm32_eval.c

In file included from .\Source\stm32_eval.c:23:

.\Source\/stm32_eval.h:138: error: expected declaration specifiers or '...' before 'USART_InitTypeDef'

.\Source\stm32_eval.c:64: error: 'GPIO_Pin_6' undeclared here (not in a function)

.\Source\stm32_eval.c:64: error: 'GPIO_Pin_7' undeclared here (not in a function)

arm-hitex-elf-gcc.exe -c -gdwarf-2 -MD -O0 -trigraphs -mcpu=cortex-m3 -mthumb -Wall -fsigned-char -mlittle-endian -mfpu=vfp -xc -mno-thumb-interwork -mno-tpcs-frame -I.\Source\ -o .\objects\stm32f10x_exti.o .\Source\stm32f10x_exti.c

.\Source\stm32f10x_exti.c: In function 'EXTI_Init':

.\Source\stm32f10x_exti.c:105: warning: implicit declaration of function 'assert_param'

Think its wrong to start changing the downloaded periph_lib sources but what else can I do ?

Even the assembler complains about the expanded macros from the ARM core files.

[ This message was edited by: Janvi on 11-10-2009 22:30 ]

akaiser9
Associate II
Posted on May 17, 2011 at 13:26

For the STREX bug in core_cm3.c, replace ''=r'' by ''=&r''.

My complaint about this file is that those single instruction functions should be placed into the .h file to be inlined by the compiler.

[ This message was edited by: prx on 18-10-2009 16:20 ]

janvi
Associate II
Posted on May 17, 2011 at 13:26

IAR compiles fine, but the lady at the phone told me, that I have to buy a

USB copy protection dongle for 4.400 Euro. ( in words: fourthousand and

fourhundred) Of coarse, this amount is without Segger download cable.

Thats why I did not waste any more time evaluating the kick start version.

To be more specific, I found 2 problems using CMSIS with GCC 4.3.3 from Hitex:

1) startup.s The File compiles but linker cannot recognize thumb mode and very

first instruction results in hard fault. Even after additional .thumb

instruction in section .text.Reset_Handler. Maybe anybody else knows a better

approach than using Reset_Vector+1 to set bit 0 for thumb mode entry?

2) core_cm3.c The GCC cannot replace the arguments of store exclusive inline

assembly. Complains from AS about strex r3,r3,[r2] are correct. Rd and Rt

must not be the same register. As long as there are no multitask, I can

hardly imagine any need for mutex instructions. Best solution for the moment

seems to drop the core_cm3 section.

Both files also compile fine, If I use codesourcery GCC 4.3.2 from Raisonance

So far about starting with a new micro with a few hours.

janvi
Associate II
Posted on May 17, 2011 at 13:26

Thank you for talking from a ''bug'' inside the ARM sources.

When I try to do something meaningfull with the StdPeriphLib,

there are still more problems remaining:

All stm32f10x_ppp.c assert_param generates a ''implicit declaration of function''

assert_param is not a function but a preprocessor macro defined in stm23F10x_conf.h

The warning is generated, becouse stm32F10x_conf.h is neither an include from

stm32f10x_ppp.c nor a chained include from stm32F103_ppp.h.

Linker later terminates with ''undefined reference to assert_param''.

For succesfull linker pass I moved the assert_param macro definition from

stm32f10x_conf.h into stm32f10x.h

janvi
Associate II
Posted on May 17, 2011 at 13:26

Hello mcd application team !

there seems more bugs in GCC startup for low density devices.

Vector table with droped .word - ''0'' seems no valid mnemonics.

Possibly Ride7 can assemble this (?) other GCC do not:

arm-hitex-elf-as.exe -mcpu=cortex-m3 -gdwarf2 -mthumb -EL -mfpu=vfp -I..\..\..\Libraries\CMSIS\Core\CM3\ -I..\ -I.\ -o .\objects\startup_stm32f10x_ld.o .\startup_stm32f10x_ld.s

.\startup_stm32f10x_ld.s: Assembler messages:

.\startup_stm32f10x_ld.s:169: Error: junk at end of line, first unrecognized character is `0'

.\startup_stm32f10x_ld.s:172: Error: junk at end of line, first unrecognized character is `0'

.\startup_stm32f10x_ld.s:173: Error: junk at end of line, first unrecognized character is `0'

.\startup_stm32f10x_ld.s:175: Error: junk at end of line, first unrecognized character is `0'

.\startup_stm32f10x_ld.s:178: Error: junk at end of line, first unrecognized character is `0'

For the Reset_Handler+1 bug, the better way seems to insert

pseudo instruction .thumb_func before label Reset_Handler:

what enables my linker to initially set the T-bit. Obviously .code 16,

.thumb or .cpu cortex-m3 cannot link correct address.

[ This message was edited by: Janvi on 25-10-2009 21:59 ]

janvi
Associate II
Posted on May 17, 2011 at 13:26

Hello MCD Application Team

\STM32F10x_StdPeriph_Lib_V3.1.2\Project\STM32F10x_StdPeriph_Examples\TIM\OnePulse readme.txt:

@par Hardware and Software environment

This example runs on STM32F10x ... Low-Density Device

The example uses Timer 4 while low density data sheet describes

only up to 2 General Purpose Timers 2+3

Readme describes T4 Ch1+2 with PA1+PA2 while example maps to PB6+7

[ This message was edited by: Janvi on 02-11-2009 17:50 ]