cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F091RC and STM32 Cryptographic library link error (RCC_AHBPeriphClockCmd undefined)

scoulibaly
Associate
Posted on March 02, 2016 at 09:19

Hi,

I know there's not such easy think than helping someone describing its issue with prose, but here I try.

In a current STM32F091RC building, linking and running project (gcc makefile), I wish I could basically cut-and-paste the SHA256 example provided in the STM32 Cryptographic library. I found compelling sample code in /Project/STM32_Cryptographic_Examples/HASH/SHA256/main.c.

In my makefile, I added the usual -I to the cryptographic library, and added the linker directive so that it links M0_CryptoFW_2_0_6.a.

The build is successfull, but at link time, the following is output :

..//crypto/lib/M0_CryptoFW_2_0_6.a(crypto.o): In function `Crypto_DeInit':

C:\SVN\MCD_STM32_Cryptographic_V2_0_6\LibraryCreation\Cortex_M0\Crypto_Sources_Files\crypto.c:(.text+0xfc90): undefined reference to `RCC_AHBPeriphClockCmd'

collect2: error: ld returned 1 exit status

I ''grep''ed for RCC_AHBPeriphClockCmd in all the include files of my project (so that I could find the missing library), but the grep didn't yield anything.

I wish someone could shed some light on this. From my Google research, I found people managing to use the crypto lib with STM32F4, but couldn't find relevant information for STM32F0 (although  understant this low end MCU is not ideal).

Thank you !

2 REPLIES 2
Posted on March 02, 2016 at 15:19

Are you using the SPL or HAL ?

The code is attempting to turn on the CRC peripheral. You could create your own version of the routine. STM32F0308-Discovery_FW_V1.0.1\Libraries\STM32F0xx_StdPeriph_Driver\src\stm32f0xx_rcc.c

/**
* @brief Enables or disables the AHB peripheral clock.
* @note After reset, the peripheral clock (used for registers read/write access)
* is disabled and the application software has to enable this clock before
* using it.
* @param RCC_AHBPeriph: specifies the AHB peripheral to gates its clock.
* This parameter can be any combination of the following values:
* @arg RCC_AHBPeriph_GPIOA: GPIOA clock
* @arg RCC_AHBPeriph_GPIOB: GPIOB clock
* @arg RCC_AHBPeriph_GPIOC: GPIOC clock
* @arg RCC_AHBPeriph_GPIOD: GPIOD clock
* @arg RCC_AHBPeriph_GPIOF: GPIOF clock
* @arg RCC_AHBPeriph_TS: TS clock
* @arg RCC_AHBPeriph_CRC: CRC clock
* @arg RCC_AHBPeriph_FLITF: (has effect only when the Flash memory is in power down mode)
* @arg RCC_AHBPeriph_SRAM: SRAM clock
* @arg RCC_AHBPeriph_DMA1: DMA1 clock
* @param NewState: new state of the specified peripheral clock.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->AHBENR |= RCC_AHBPeriph;
}
else
{
RCC->AHBENR &= ~RCC_AHBPeriph;
}
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
scoulibaly
Associate
Posted on March 14, 2016 at 17:53

Hi Clive1,

Thank you for this snippet. It made the trick through building. I'm using HAL.

KH