# FreeRTOS + TCP, tutorial, STM32F7 questions.

**URL:** <https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454>\
**Category:** Kernel\
**Created:** [October 6, 2018, 9:39pm UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454 "2018-10-06T21:39:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 6, 2018, 9:39pm UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/1 "2018-10-06T21:39:22Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Saturday, October 06, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#2523):

I’m trying to build a TCP/IP application using FreeRTOS 10 + TCP/IP on an STM32F767ZI-Nucleo-144 board.

1. Starting with CubeMX and FreeRTOS 9. Got LED’s and printf’s working on UART 3.
2. I then replaced the FreeRTOS 9 files with version 10 files from their official SVN repository.  
This worked.
3. I started following the tutorial, copied the IP files over, created a config file, and am stuck at this step:  
[https://www.freertos.org/FreeRTOS-Plus/FreeRTOS\_Plus\_TCP/TCP\_Networking\_Tutorial\_Initialising\_TCP.html](https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Networking_Tutorial_Initialising_TCP.html)

Of the many errors, the first is:  
undefined reference to ucMACAddress in NetworkInterface.c

The tutorial defines it as a global in main.c:

```auto
static uint8_t ucMACAddress[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };

```

but NetworkInterface.c references it this way:

```auto
/* ucMACAddress as it appears in main.c */
extern const uint8_t ucMACAddress[6];

```

I’ve tried various combinations to get around this, like removing const, as that clearly is wrong, (plus global header file, main.h, commenting out, etc.) but am unable to figure out how to get these variables (and other errors) cleaned up so I can proceed in the tutorial.

I’m an intermediate C programmer, but I get lost when trying to merge these libraries with disparate header files and global variables.

Any guidance would be appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 7, 2018, 1:33am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/2 "2018-10-07T01:33:43Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Sunday, October 07, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#2731):

Hi Abe, you can get around the above problem by changing the declaration in your main.c to:

```auto
    const uint8_t ucMACAddress[6] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };

```

Here is a post about the recent STM32Fxx driver:

[https://sourceforge.net/p/freertos/discussion/382005/thread/e6c5bd5f/?limit=250#fbd7](https://sourceforge.net/p/freertos/discussion/382005/thread/e6c5bd5f/?limit=250#fbd7)

It needs one of these defines: `STM32F7xx`, `STM32F4xx` or `STM32F2xx` to indicate the type of CPU. I haven’t tested it on a STM32F2 my self, but it seems to work.

I will attach the latest version here below as “STM32Fxx\_tcp\_driver\_7\_Oct\_2018.7z”. It won’t refer to `ucMACAddress[]` anymore.  
Please unpack the 7-zip in “FreeRTOS-Plus-TCP\source\portable\NetworkInterface”.

When using this driver, you should also include:

```auto
    FreeRTOS-Plus-TCP\source\portable\NetworkInterface\Common\phyHandling.c

```

and add this path to the list of include directories:

```auto
    FreeRTOS-Plus-TCP\source\portable\NetworkInterface\include

```

Please tell me how it works for you.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 7, 2018, 7:29pm UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/3 "2018-10-07T19:29:46Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Sunday, October 07, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#24ac):

OK, thanks for the info and files. 🙂

I added STM32F7xx to Atollic’s (Eclipse) project symbol list, which solved some of the problems.

I had to remove all the eventLog lines from phyHandling.c (no sign of eventLogging.h anywhere.)

And I also need to paste in a ulApplicationGetNextSequenceNumber function, as found here: [https://sourceforge.net/p/freertos/discussion/382005/thread/86b911fb/](https://sourceforge.net/p/freertos/discussion/382005/thread/86b911fb/)

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 7, 2018, 8:52pm UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/4 "2018-10-07T20:52:44Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Sunday, October 07, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#9c06):

I’m not seeing your xCheckLoopback() in FreeRTOS\_ARP.h/c… As mentioned here: [https://www.freertos.org/FreeRTOS\_Support\_Forum\_Archive/February\_2018/freertos\_FreeRTOS-Plus\_TCP\_760109c4j.html](https://www.freertos.org/FreeRTOS_Support_Forum_Archive/February_2018/freertos_FreeRTOS-Plus_TCP_760109c4j.html)

(I’m using latest svn)

It’s also failling on undefined reference to xQueueCreateCountingSemaphore in BufferAllocation\_2.c, even though I have #define configSUPPORT\_DYNAMIC\_ALLOCATION 1 in FreeRTOSConfig.h. [https://www.freertos.org/CreateCounting.html](https://www.freertos.org/CreateCounting.html)

Thanks. 🙂

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 7, 2018, 11:36pm UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/5 "2018-10-07T23:36:21Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Sunday, October 07, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#c0d5):

Hi, thanks for the feedback.

> I had to remove all the eventLog lines from phyHandling.c  
> (no sign of eventLogging.h anywhere.)

I think that you used and older file and not the one that I attached yesterday as:  
[STM32Fxx\_tcp\_driver\_7\_Oct\_2018.7z](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/2731/attachment/STM32Fxx_tcp_driver_7_Oct_2018.7z)

`eventLog()` is my own thing: it saves strings in a circular buffer, used for “real-time” debugging.

> I’m not seeing your xCheckLoopback() in FreeRTOS\_ARP.h/c  
> You can find it in [this earlier post](https://sourceforge.net/p/freertos/discussion/382005/thread/760109c4/?limit=250#8a99)

But you can also comment it out.  
I hope that the changes for the loop-back interface can be merged with the FreeRTOS/AWS release. At the same time, the drivers under NetworkInterface must be updated / merged.

I think that in order to get `xQueueCreateCountingSemaphore()` compiled, you need these two defines:

```auto
#define configUSE_COUNTING_SEMAPHORES 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1

```

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 9, 2018, 1:27am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/6 "2018-10-09T01:27:17Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Tuesday, October 09, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#792d):

Thanks, Hein, I appreciate your time. I’m still totally confused on bringing in these libraries… 😕

Am I using the right SVN repository?

The eventlogging was from my list of compile errors to track down. It was in the SVN.

I created a uxRand() that calls HAL\_RNG\_GetRandomNumber(&hrng), which is uint32\_t, but elsewhere unsigned long and elsewhere UBaseType\_t. (So many layers of redefinitions!)

Can’t seem to resolve xQueueCreateCountingSemaphore, more layers of nested definitions. I tried adding mpu\_wrappers.h to NetworkInterface.c, but it didn’t work.

```auto
mpu_prototypes.h
95: QueueHandle_t MPU_xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount );  

mpu_wrappers.h
100: #define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore  

queue.h 
1416: QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;  

semphr.h
998: #define xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ) xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )  

```

Also, the stm32fxx\_hal\_eth.h you gave me seems to conflict with stm32\_hal\_legacy.h.

I tried removing it, but there are a number of other headers that depend on it.

```auto
Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h
1001:#define ETH_MAC_TXFIFO_WRITE_ACTIVE 0x00400000U /* Tx FIFO write active */

Middlewares/Third_Party/FreeRTOS-Plus-TCP/portable/NetworkInterface/include/stm32fxx_hal_eth.h
1249:#define ETH_MAC_TXFIFO_WRITE_ACTIVE ((uint32_t)0x00400000) /* Tx FIFO write active */

```

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 9, 2018, 8:18am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/7 "2018-10-09T08:18:26Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Tuesday, October 09, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#2c48):

> Am I using the right SVN repository?

You can use SVN : [FreeRTOS Real Time Kernel (RTOS) / Code / [r2837]](https://sourceforge.net/p/freertos/code/HEAD/tree/)  
or github : [GitHub - aws/amazon-freertos: DEPRECATED - See README.md](https://github.com/aws/amazon-freertos)

> The eventlogging was from my list of compile errors to track down. It was in the SVN.

It could be that some sources file in the SVN still contained a reference to “eventlogging”. Sorry for that.

> I created a uxRand() that calls HAL\_RNG\_GetRandomNumber(&hrng), which is uint32\_t,  
> but elsewhere unsigned long and elsewhere UBaseType\_t. (So many layers of redefinitions!)

`uxRand()` came up a bit /ad hoc/, while the demo sources were being created. It is part of the demo’s, not part of a FreeRTOS library. I’d vote to make it `uint32_t`.

> Can’t seem to resolve xQueueCreateCountingSemaphore, more layers of nested definitions. Confusing.

Have you defined these:

```auto
    #define configUSE_COUNTING_SEMAPHORES 1
    #define configSUPPORT_DYNAMIC_ALLOCATION 1

```

already? If so, you get the `xQueueCreateCountingSemaphore()` from task.c

> Also, the stm32fxx\_hal\_eth.h you gave me seems to conflict with stm32\_hal\_legacy.h.  
> I tried removing it, but there are a number of other headers that depend on it.

ST’s header file “stm32\_hal\_legacy.h” has also gone through a series of changes. In the older versions, it did not define `ETH_MAC_TXFIFO_WRITE_ACTIVE`. In later versions it was defined as:

```auto
#define ETH_MAC_TXFIFO_WRITE_ACTIVE ((uint32_t)0x00400000) /* Tx FIFO write active */

```

and again later it is defined as:

```auto
#define ETH_MAC_TXFIFO_WRITE_ACTIVE 0x00400000U /* Tx FIFO write active */

```

I don’t know how to handle this. You could put an empty file:

```
portable\NetworkInterface\STM32Fxx\stm32_hal_legacy.h

```

Or you can define `__STM32_HAL_LEGACY` before `stm32f7xx_hal.h` gets included.  
I mean in “portable\NetworkInterface\STM32Fxx\stm32fxx\_hal\_eth.c” :

```auto
 /* Includes ------------------------------------------------------------------*/
+#define __STM32_HAL_LEGACY 1
 #if defined(STM32F7xx)
     #include "stm32f7xx_hal.h"
     #include "stm32f7xx_hal_def.h"
     #define stm_is_F7 1
 #elif defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
     #include "stm32f4xx_hal.h"
     #include "stm32f4xx_hal_def.h"
     #define stm_is_F4 1

```

The NetworkInterface drivers always depend on chip libraries. We had to make some changes to them and therefor we also provided a `stm32fxx_hal_eth.h`.  
I hope that you can find an easy solutuion to this.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 9, 2018, 10:45pm UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/8 "2018-10-09T22:45:56Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Tuesday, October 09, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#cbda):

Defining configUSE\_COUNTING\_SEMAPHORES got it to compile. I’ll see if I can progress now.

Thanks! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 10, 2018, 8:29am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/9 "2018-10-10T08:29:21Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Wednesday, October 10, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#3802):

I went back to the original SVN code, edited NetworkInterface.c and got rid of all the duplicate definitions. Much simpler for me to stick to the default CMSIS/HAL setup from ST.

Still, thanks for your insight and feedback. I’ve gotten further in the tutorial, (had to account for a few variable name changes since the tutorial), and hopefully, tomorrow, talk to my echo server.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 11, 2018, 2:59am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/10 "2018-10-11T02:59:31Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Thursday, October 11, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#7300):

I’ve set FreeRTOSIPconfig.h to DHCP and set printf (through UART) for debug and ipconfig output.

Says Link Status still low regardless of cable inserted or not. The cable lights are on and occasionally blink off. I know this cable works.

Any suggestions?

Thanks.

prvIPTask started  
prvEthernetUpdateConfig: LS mask 00 Force 1  
Network buffers: 56 lowest 56  
Link Status still low  
Link Status still low  
Link Status still low  
Link Status still low  
Link Status still low  
Link Status still low  
Link Status still low  
Network buffers: 55 lowest 55  
Link Status still low  
Link Status still low  
Link Status still low  
Link Status still low  
Link Status still low  
Link Status still low

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 11, 2018, 7:08am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/11 "2018-10-11T07:08:11Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Thursday, October 11, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#6db6):

Hi Abe, have you checked two other things: whether the choice for RMII versus MII is made correctly? And also ( related ) if you have configured all Ethernet pins in a correct way?

> I went back to the original SVN code, edited NetworkInterface.c and got rid of  
> all the duplicate definitions. Much simpler for me to stick to the default  
> CMSIS/HAL setup from ST.

You’re reporting a problem with a driver ( from SVN ) that is outdated. We had good reasons to make changes to that driver.  
I tested the most recent STM32Fxx driver on my STM32F7 disco board.

It would be handy if you can use [the latest driver](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/2731/attachment/STM32Fxx_tcp_driver_7_Oct_2018.7z). If you want, tell me which HAL version you’re using and I will try compile it.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 11, 2018, 10:11am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/12 "2018-10-11T10:11:59Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Thursday, October 11, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#be9e):

Hein, Thanks, I pushed what I have here: [https://gitlab.com/abeowitz/netapp](https://gitlab.com/abeowitz/netapp)

I’m using the HAL drivers from STM32CubeMX (F7 v 1.12), and I’m configured for RMII. The FreeRTOS-IP ones are renamed \*.h.bak.

I’ll try the new driver again, but all these different HAL drivers, dependencies and duplicate declarations are a nightmare…

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 11, 2018, 3:16pm UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/13 "2018-10-11T15:16:31Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Thursday, October 11, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#0f5c):

Thanks for uploading your project. I comiled the latest NetworkInterface along with your HAL library, and it really helps to add this patch:

```auto
 #include "phyHandling.h"
 
+#define __STM32_HAL_LEGACY 1
 
 /* ST includes. */
 #if defined( STM32F7xx )
 	#include "stm32f7xx_hal.h"

```

When `__STM32_HAL_LEGACY` is defined, `stm32_hal_legacy.h` will not be included anymore. And that saves a lot of conflicts.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 11, 2018, 6:12pm UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/14 "2018-10-11T18:12:31Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Thursday, October 11, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#8640):

Wow, thanks! I’ll check this out tonight. (Off to doctor appt.)

I also need to check the docs, as STM32CubeMX hinted that I may need TIM2 connected with TRIG1…

Is your STM32F7 Disco project available online?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 12, 2018, 3:41am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/15 "2018-10-12T03:41:19Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Friday, October 12, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#c3c0):

Here’s a confusing thing. Atollic(Ecllipse) will automatically edit #includes if I rename the files.

#include “stm32f7xx\_hal\_eth.h”

Now I rename stm32f7xx\_hal\_eth.h -\> stm32f7xx\_hal\_eth.h.bak

And Atollic edits the file:  
#include “stm32f7xx\_hal\_eth.h.bak”

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 12, 2018, 4:12am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/16 "2018-10-12T04:12:05Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Friday, October 12, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#7cbe):

Adding #define STM32\_HAL\_LEGACY 1 in NetworkInterface.c with your new driver allows me to compile, but nothing works. No interrupts, printf’s, anything. Debugger shows it’s wandering around HAL code.

And I still get a bunch of redefined warnings.

If I define STM32\_HAL\_LEGACY in main.h, then there are a number of definitions missing. GPIO\_SPEED\_HIGH, for example, is in stm32\_hal\_legacy.h.

Seems I need bits and pieces of various headers. And being a newb to the PHY stuff, I’m still confused. 😕

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 12, 2018, 7:02am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/17 "2018-10-12T07:02:03Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Friday, October 12, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#c518):

> Here’s a confusing thing. Atollic(Ecllipse) will automatically edit  
> #includes if I rename the files.
> 
> #include “stm32f7xx\_hal\_eth.h”
> 
> Now I rename stm32f7xx\_hal\_eth.h → stm32f7xx\_hal\_eth.h.bak
> 
> And Atollic edits the file:  
> #include “stm32f7xx\_hal\_eth.h.bak”

I think that all Eclipse IDE’s will do that, if… you let the IDE maintain your project.

Can you go to the properties of the header file and tick: “exclude resource from build”?

I always use “Makefile” projects and import those into Eclipse. A Makefile project can easily be maintained and compiled outside an IDE.

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 12, 2018, 7:55am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/18 "2018-10-12T07:55:54Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Friday, October 12, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#fa3a):

> Adding `#define STM32_HAL_LEGACY 1` in NetworkInterface.c with your new driver allows me to compile

Great, one step further

In your project, there is still `stm32f7xx_hal_eth.c`, can you also exclude that from being built?  
In TrueStudio, see its properties, tab “C/C++ build”, tick “Exclude resource from build”.

And also any existing `stm32f7xx_hal_eth.h` should be removed or become invisible for the compiler.  
The FreeRTOS+TCP driver wants to replace all “stm32f\*\_hal\_eth\*” files.

> but nothing works. No interrupts, printf’s, anything. Debugger shows it’s wandering around HAL code.

Patience, you’ll get that working. I don’t know about the `printf`s because we did not implement them.

> And I still get a bunch of redefined warnings.  
> If I define STM32\_HAL\_LEGACY in main.h, then there are a number of definitions missing.  
> GPIO\_SPEED\_HIGH, for example, is in stm32\_hal\_legacy.h.

In main.c you do not need `stm32f7xx_hal_eth.h`, so you could define :

```auto
	#define __STM32F7xx_HAL_ETH_H 1

```

To avoid inclusion of that header file, and do not define `__STM32_HAL_LEGACY` in your main.c.

I have an STM32F746G DISCO board, which has the same Ethernet connections as your STM32F767ZI-Nucleo-144.

Have you checked ST’s document en.DM00244518.pdf already? It describes the switches that you must set in order to make Ethernet working.

Your board also uses the Reduced Media-Independent Interface, so your `freeRTOSIPConfig.h **must** define:

```auto
	#define ipconfigUSE_RMII 1

```

The pins are initialised by `HAL_ETH_MspInit()`, which will be called from `stm32fxx_hal_eth.c`.

Debugging: could you put a breakpoint within `vMACBProbePhy()`? And if it doesn’t get called, please check how far it comes in the function `HAL_ETH_Init()`.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 14, 2018, 4:08am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/19 "2018-10-14T04:08:49Z")

</div>

**[abeowitz](https://sourceforge.net/u/abeowitz/)** wrote on [Sunday, October 14, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#5d90):

I also have an STM32F7 DISCO board…

Would it be too much trouble to ask you to make a simple starter build for me? If so, please start with STM32CubeMX, add FreeRTOS 10 + TCP/IP and generate it for Atollic TrueStudio and just bring it up to FreeRTOS\_IPInit() with DHCP.

If I have a working project on the DISCO, I can build my STM32F767ZI project, do a side-by-side comparison, and learn how to put all the pieces together…

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 14, 2018, 5:01am UTC](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454/20 "2018-10-14T05:01:00Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Sunday, October 14, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/11f944864b/#e633):

Hi Abe, can we connect through email: “hein [at] htibosch [dot] net”?  
That will be easier to share projects and code. Thanks,

[Next page](https://forums.freertos.org/t/freertos-tcp-tutorial-stm32f7-questions/7454.md?page=2)
