Hi Jan
Just adding to the other two very good replies
My experience with codec2 with STM32F4/F7 At O0, the performance may be
down to 50% of -O2, and also, with O0, its likely the compiler is not
exploiting any hardware speedups as with GCC there are some (invisible)
ties between -O level, and the use of the hardware flags.
However ! I would certainly investigate why you have hardfaults. It may
be that the processor is not keeping up with interrupt processing etc,
but I would suggest - put some code in there for the hard fault handler
so it stops and you can see why happend
best
glen
here are some examples:
this is an EXCELLENT primer :
https://www.freertos.org/Debugging-Hard-Faults-On-Cortex-M-Microcontrollers.html?_ga=2.258623882.1201655825.1700519821-15576747.1700519821
*******and code I use :
void HardFault_Handler( void ) __attribute__( ( naked ) );
void prvGetRegistersFromStack( uint32_t *pulFaultStackAddress )
{
/* These are volatile to try and prevent the compiler/linker optimising them
away as the variables never actually get used. If the debugger won't
show the
values of the variables, make them global my moving their declaration
outside
of this function. */
volatile uint32_t r0;
volatile uint32_t r1;
volatile uint32_t r2;
volatile uint32_t r3;
volatile uint32_t r12;
volatile uint32_t lr; /* Link register. */
volatile uint32_t pc; /* Program counter. */
volatile uint32_t psr;/* Program status register. */
r0 = pulFaultStackAddress[ 0 ];
r1 = pulFaultStackAddress[ 1 ];
r2 = pulFaultStackAddress[ 2 ];
r3 = pulFaultStackAddress[ 3 ];
r12 = pulFaultStackAddress[ 4 ];
lr = pulFaultStackAddress[ 5 ];
pc = pulFaultStackAddress[ 6 ];
psr = pulFaultStackAddress[ 7 ];
/* When the following line is hit, the variables contain the
register values. */
for( ;; );
}
void HardFault_Handler(void)
{
__asm volatile
(
" tst lr, #4 \n"
" ite eq \n"
" mrseq r0, msp \n"
" mrsne r0, psp \n"
" ldr r1, [r0, #24] \n"
" ldr r2, handler2_address_const \n"
" bx r2 \n"
" handler2_address_const: .word prvGetRegistersFromStack \n"
);
}
On 21/11/2023 12:21 am, Jan Ropek wrote:
Hello,
my goal was to get Codec2 (encoding and decoding) working on STM32F446
running on 180MHz. So, I created a new project for Nucleo with F446RE
and added Codec2 libraries to it. I compile with GCC (using
STM32CubeIDE - based on Eclipse).
I have GCC optimization turned off and encoding and decoding works,
but the problem is that encoding one 40ms frame (320 B) takes about 47
ms, so I am not able to use Codec2 in real-time. So, I am asking
whether my requirements are unrealistic, or have I implemented Codec2
incorrectly?
- I tried comparing CMSIS FFT and KISS FFT, it takes roughly the same
time.
- When I turned on GCC optimization to O1 - encoding sped up to about
15 ms, but during decoding, a HardFault always occurred.
Can you please suggest what I might be doing wrong? Many thanks!
Best regards, Jan.
_______________________________________________
Freetel-codec2 mailing list
Freetel-codec2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
_______________________________________________
Freetel-codec2 mailing list
Freetel-codec2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freetel-codec2