2014-03-13 03:55 AM
Hi
I'm using STLibraries for programing a STM32F100 in crossStudio. I have my System Clock with 24MHz. When I set and reset a port pin, using LT Librarieswhile(1){ GPIO_SetBits(DISP_DIGIT1_PORT, DISP_DIGIT1_PIN); GPIO_ResetBits(DISP_DIGIT1_PORT,DISP_DIGIT1_PIN);} since the moment of set to the moment of reset the uController spend, more or less, 2.26us (442KHz). On the other hand, if I do the same using the uController register while(1){ DISP_DIGIT1_PORT->BSRR = DISP_DIGIT1_PIN; DISP_DIGIT1_PORT->BRR = DISP_DIGIT1_PIN; }the this time is only 164ns (6.1MHz).So, my questions are : This diferences on time is normal? There are any solucion for using LTLibraries and reduce this time?Best RegardsA Paiva2014-03-13 04:07 AM
> This diferences on time is normal?
Look at the generated assembler. The first one probably results in function calls, the second is probably inlined as one or few instructions. > There are any solucion for using LTLibraries and reduce this time? Switch on optimizations. JW