stm32duino / STM32Ethernet

Arduino library to support Ethernet for STM32 based board
156 stars 43 forks source link

STM32Ethernet + STM32FreeRTOS #25

Closed nopnop2002 closed 5 years ago

nopnop2002 commented 5 years ago

I tried to use STM32Ethernet + STM32FreeRTOS.

My sketch is here: It works perfect.

//#include <STM32FreeRTOS.h>
#include <LwIP.h>
#include <STM32Ethernet.h>

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // Start Ethernet
  Serial.println("Start Ethernet.begin");
  if (Ethernet.begin() == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for (;;)
      ;
  }
  Serial.println("Success to configure Ethernet using DHCP");

  Serial.print("localIP: ");
  Serial.println(Ethernet.localIP());
  Serial.print("subnetMask: ");
  Serial.println(Ethernet.subnetMask());
  Serial.print("gatewayIP: ");
  Serial.println(Ethernet.gatewayIP());
  Serial.print("dnsServerIP: ");
  Serial.println(Ethernet.dnsServerIP());

#if 0
  // start scheduler
  vTaskStartScheduler();
  Serial.println("Insufficient RAM");
  while(1);  
#endif
}

//------------------------------------------------------------------------------
// WARNING loop() called from vApplicationIdleHook(), so don't use this function.
// loop must never block
void loop() {
  // Not used.
}

EthernetBegin

But when i enable STM32FreeRTOS.h, compile error occure.

Can i use STM32Ethernet + STM32FreeRTOS.

Warning: Board atmega64:avr:memduino64_8MHz doesn't define a 'build.board' preference. Auto-set to: AVR_MEMDUINO64_8MHZ
Warning: Board atmega644_1284:avr:avrmega644p doesn't define a 'build.board' preference. Auto-set to: AVR_AVRMEGA644P
Warning: Board atmega644_1284:avr:avrmega1284p doesn't define a 'build.board' preference. Auto-set to: AVR_AVRMEGA1284P
Warning: Board atmega644_1284:avr:avrmega644p16 doesn't define a 'build.board' preference. Auto-set to: AVR_AVRMEGA644P16
Warning: Board atmega644_1284:avr:avrmega1284p16 doesn't define a 'build.board' preference. Auto-set to: AVR_AVRMEGA1284P16
�T�u�f�B���N�g���܂��̓t�@�C�� sketch �͊��ɑ��݂��܂��B

In file included from \\LANDISK-HDL-AA1\disk1\Arduino\libraries\STM32FreeRTOS-master\src\heap.c:19:
\\landisk-hdl-aa1\disk1\arduino\libraries\stm32freertos-master\portable\memmang\heap_usenewlib.c: In function '__malloc_lock':
\\landisk-hdl-aa1\disk1\arduino\libraries\stm32freertos-master\portable\memmang\heap_usenewlib.c:112:1: error: number of arguments doesn't match prototype
 void __malloc_lock()     {       vTaskSuspendAll(); };
 ^~~~
In file included from \\landisk-hdl-aa1\disk1\arduino\libraries\stm32freertos-master\portable\memmang\heap_usenewlib.c:52,
                 from \\LANDISK-HDL-AA1\disk1\Arduino\libraries\STM32FreeRTOS-master\src\heap.c:19:
c:\users\user\documents\arduinodata\packages\stm32\tools\arm-none-eabi-gcc\8.2.1-1.7\arm-none-eabi\include\malloc.h:136:13: error: prototype declaration
 extern void __malloc_lock(struct _reent *);
             ^~~~~~~~~~~~~
In file included from \\LANDISK-HDL-AA1\disk1\Arduino\libraries\STM32FreeRTOS-master\src\heap.c:19:
\\landisk-hdl-aa1\disk1\arduino\libraries\stm32freertos-master\portable\memmang\heap_usenewlib.c: In function '__malloc_unlock':
\\landisk-hdl-aa1\disk1\arduino\libraries\stm32freertos-master\portable\memmang\heap_usenewlib.c:113:1: error: number of arguments doesn't match prototype
 void __malloc_unlock()   { (void)xTaskResumeAll();  };
 ^~~~
In file included from \\landisk-hdl-aa1\disk1\arduino\libraries\stm32freertos-master\portable\memmang\heap_usenewlib.c:52,
                 from \\LANDISK-HDL-AA1\disk1\Arduino\libraries\STM32FreeRTOS-master\src\heap.c:19:
c:\users\user\documents\arduinodata\packages\stm32\tools\arm-none-eabi-gcc\8.2.1-1.7\arm-none-eabi\include\malloc.h:138:13: error: prototype declaration
 extern void __malloc_unlock(struct _reent *);
             ^~~~~~~~~~~~~~~
exit status 1
nopnop2002 commented 5 years ago

I updated STM32FreeRTOS from 9.0.3 to 10.0.1. My problem is solved. I can use STM32Ethernet + STM32FreeRTOS.