Skip to content

Conversation

ldehenni
Copy link

STM32 network interface bug fixes

Description

All modifications are isolated to the STM32 networkinterface.c file.

A documented bug in the STM32 HAL drivers has since been fixed for the F7 port (STMicroelectronics/stm32f7xx-hal-driver@2770385).

I removed warnings and asserts related to said target (F7), but kept enforcing them for F4.

In the network driver traceISR_ENTER() is called but isn't defined anywhere, not in TCP or in FreeRTOS.
I have removed it, but defining an empty macro in the appropriate file would also work.

As it wasn't respecting the iptraceXXX I sepcifically didn't add it to the ip default macros.

Test Steps

Compiling for STM32F7

Checklist:

  • [ X] I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Louis Dehennin added 2 commits May 23, 2025 14:12
It is not defined anywhere in TCP or FreeRTOS.
* The bug has been fixed in the F7 driver: STMicroelectronics/stm32f7xx-hal-driver@2770385
* After verification the drivers shipped with FreeRTOS-Plus-TCP contain the fix already.
* The bug is still present for the F4 drivers.
* Updated the warning accordingly.
* Enforced assert only when compiling for STM32F4.
@ldehenni ldehenni requested a review from a team as a code owner May 23, 2025 12:37

void ETH_IRQHandler( void )
{
traceISR_ENTER();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

traceISR_ENTER is part of the trace macros that got added to FreeRTOS kernel with FreeRTOS/FreeRTOS-Kernel#659

The change is part of the Kernel V11.0.0 and above.

I would suggest keeping it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I see

#ifndef traceISR_ENTER
    #define traceISR_ENTER()
#endif

What if I upgrade my +TCP and keep on using an older kernel?

 void ETH_IRQHandler( void )
 {
+
+    #if defined( traceISR_ENTER )
+        /* The following macro is defined in FreeRTOS.h
+         * in kernels "V11.2.0" or higher. */
+        traceISR_ENTER();
+    #endif

     ETH_HandleTypeDef * pxEthHandle = &xEthHandle;

Hi @ldehenni, thanks for you PR.

What about the above code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HTRamsey , are you OK with this PR?

@tony-josi-aws , shall we add a default declaration like:

+    #if defined( traceISR_ENTER )
+        /* The following macro is defined in FreeRTOS.h
+         * in kernels "V11.2.0" or higher. */
+        traceISR_ENTER();
+    #endif

Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@tony-josi-aws
Copy link
Member

@ldehenni

Thanks for taking time to contribute to FreeRTOS+TCP.

@HTRamsey HTRamsey mentioned this pull request Jul 30, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants