FreeRTOS+UDP on Pic24

Hello, I just wanted to know if somebody has already ported FreeRtOS+UDP to Microchip P24 ? I already understand the chapter http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Ethernet_Porting.shtml for functions description but have no idea about amount of job, the other solution is probably to use the entire TCPIPStack from Microchip but probably with more problem concerning multitasking.. So I am not asking to do the job but just having some input and thought about this problem. Regards and Thanks

FreeRTOS+UDP on Pic24

…no replies, so I guess nobody reading the thread has anyway. Porting is quite straight forward, and even more so if Microchip provide their own drivers.  Stick to the ‘standard’ rather than ‘zero copy’ interface to start with as it is simpler.  If you need the extra performance you can add in the zero copy interface once the standard one is working. I’m not aware of any PIC24 devices with Ethernet on-board so maybe you are planning on using one of the MAC/PHY devices with an SPI interface – if so then I’m sure you will be able to get some source code from Microchip too. Regards.

FreeRTOS+UDP on Pic24

Dear Richard, No replies OR nobody did the job to port FrreRTOS+UDP on Pic24 ! by the way I am using my own board with ENC424J600 from Microchip, so the hardware driver is not a problem with SPI interface, if I understood well I have to concentrate effort on 3 functions to interface with freertos+udp…  I will try to do it… if any question comes up, I hope to have little support from here.. Regards

FreeRTOS+UDP on Pic24

Dear Richard, I have 2 questions concerning frreRTOS+UDP : 1) Concerning pack_struct_end.h and start does this FreeRTOS-Plus/FreeRTOS-Plus-UDP/portable/Compiler/GCC already contains implementations for other compilers that can be used directly, or as a reference when adding new compiler ports is ok for Xc compiler for pic24 ? 2) When compiling I got error that the file demoiptrace.h is missing, I did not find in the available files is this normal ? Best Regards

FreeRTOS+UDP on Pic24

1)
pack_struct_start/end.h has definitions for the compilers that have already been used by us.  You can add to the files as needed by the compiler you are using. I think XC is GCC, so it might be that you don’t need to edit the files at all.  Although, having a quick look at the XC16 user guide, it seems that you may need to use __pack to pack structures, as in:
__pack struct DATAPOINT {
unsigned char type;
int value;
} x-point;
…cut from the user guide directly.  That means pack_struct_start would contain __pack and pack_struct_end would contain just the semicolon (;).
2)
You can either include the path to the demoiptrace.h header file (which I think is part of FreeRTOS-Plus/Demo, rather than FreeRTOS-Plus/Source) or remove the line:
#include "DemoIPTrace.h"
from the bottom of FreeRTOSIPConfig.h so it does not even try including the header file.  The header file in question is just an example of how the UDP trace macros can be used and is not necessary for the UDP stack to function correctly. Regards.

FreeRTOS+UDP on Pic24

Thanks Richard, Very strange error when compiling, is says The FreeRTOS header file task.h must be included before FreeRTOS_Sockets.h., when looking at task.h the define is like this : #ifndef INC_TASK_H
#define INC_TASK_H so the error is normal since FreeRTOS_Sockets.his expecting to have TASK_H define instead of INC_TASK_H may be a change in v 7.5.2 ? Regards

FreeRTOS+UDP on Pic24

Yes – the definition in task.h was changed in V7.5.0 to make it consistent with the other files.  What you are seeing is a slight “side effect” ;o) of the change that is in the current release, although it has been corrected in the SVN copy.  Just change it manually from TASK_H to INC_TASK_H for now to get you past that. Regards.

FreeRTOS+UDP on Pic24

I did the change before your answer, thanks. Anther side effect may be this error appears : FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_UDP_IP.c:63:5: error: missing binary operator before token “1000” this is on the line #if configTICK_RATE_HZ > 1000
#error configTICK_RATE_HZ must be less than 1000 to use FreeRTOS+UDP
#endif for me nothing abnormal or may be the error is on freertosconfig.h : #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) ?? Regards

FreeRTOS+UDP on Pic24

It might just be complaining about the cast to portTickType in the #define. The cast is not needed. Regards.

FreeRTOS+UDP on Pic24

Dear Richard, Progressing and trying to at least compile the FreeRTOS + UDP with mplabX and latest version of FreeRtos : 1) Concerning __pack it does nor work on XC16 latest version it can not compile also if flag “use CCI syntax ” is checked so the only things ok is __attribute__((__packed__)) and semicolon at the end of struct definition. Except this point I still have strange error on all these lines : xNetworkBufferDescriptor_t *pxNetworkBufferGet( size_t xRequestedSizeBytes, portTickType xBlockTimeTicks );
xNetworkBufferDescriptor_t *pxNetworkBufferGetFromISR( size_t xRequestedSizeBytes );
void vNetworkBufferRelease( xNetworkBufferDescriptor_t * const pxNetworkBuffer );
portBASE_TYPE vNetworkBufferReleaseFromISR( xNetworkBufferDescriptor_t * const pxNetworkBuffer ); Error is : FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/NetworkBufferManagement.h:45:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token and after few time of searching I can not solve them. Regards

FreeRTOS+UDP on Pic24

Looks like it does not know what xNetworkBufferDescriptor_t is. xNetworkBufferDescriptor_t must be defined in a header file. Is the header file being included?

FreeRTOS+UDP on Pic24

Yes included.

FreeRTOS+UDP on Pic24

I have only few error at the linking now but very strange error : build/default/production/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_Sockets.o(.text+0x2c6): In function `.LSM86′:: undefined reference to `_xQueueCreateCountingSemaphore’
build/default/production/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/BufferManagement/BufferAllocation_2.o(.text+0xc): In function `.LSM2′:
: undefined reference to `_xQueueCreateCountingSemaphore’ I can not find any trace of this function xQueueCreateCountingSemaphore somewhere ! Regards

FreeRTOS+UDP on Pic24

Set configUSE_COUNTING_SEMAPHORES to 1 in FreeRTOSConfig.h to make the function available. xQueueCreateCountingSemaphore() is not directly a part of the public API but called indirectly by the xSemaphoreCreateCounting() macro (defined in semphr.h).

FreeRTOS+UDP on Pic24

Thanks Dave it is ok now, I was also oblige to add ping function in order to link correctly, now building is done…

FreeRTOS+UDP on Pic24

I was also oblige to add ping function in order to link correctly, now building is done…
If you set ipconfigSUPPORT_OUTGOING_PINGS to 1 in FreeRTOSIPConfig.h then you need to supply a ping reply hook.  If you don’t need that then set ipconfigSUPPORT_OUTGOING_PINGS to 0. Regards.