Ethernet for Nucleo and Disco board STM32F746 works with gcc and arm. IAC is untested

Dependents:   STM32F746_iothub_client_sample_mqtt DISCO-F746NG_Ethernet Nucleo_F746ZG_Ethernet thethingsiO-DISCO_F746NG-mqtt ... more

Committer:
DieterGraef
Date:
Thu Jun 23 09:04:23 2016 +0000
Revision:
1:28ba13dd96f7
Parent:
0:d26c1b55cfca
corrected MAC issue. The MAC is now 02:00:00:xx:xx:xx where xx is the sum over the unique device register

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:d26c1b55cfca 1 /*
DieterGraef 0:d26c1b55cfca 2 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
DieterGraef 0:d26c1b55cfca 3 * All rights reserved.
DieterGraef 0:d26c1b55cfca 4 *
DieterGraef 0:d26c1b55cfca 5 * Redistribution and use in source and binary forms, with or without modification,
DieterGraef 0:d26c1b55cfca 6 * are permitted provided that the following conditions are met:
DieterGraef 0:d26c1b55cfca 7 *
DieterGraef 0:d26c1b55cfca 8 * 1. Redistributions of source code must retain the above copyright notice,
DieterGraef 0:d26c1b55cfca 9 * this list of conditions and the following disclaimer.
DieterGraef 0:d26c1b55cfca 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
DieterGraef 0:d26c1b55cfca 11 * this list of conditions and the following disclaimer in the documentation
DieterGraef 0:d26c1b55cfca 12 * and/or other materials provided with the distribution.
DieterGraef 0:d26c1b55cfca 13 * 3. The name of the author may not be used to endorse or promote products
DieterGraef 0:d26c1b55cfca 14 * derived from this software without specific prior written permission.
DieterGraef 0:d26c1b55cfca 15 *
DieterGraef 0:d26c1b55cfca 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
DieterGraef 0:d26c1b55cfca 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
DieterGraef 0:d26c1b55cfca 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
DieterGraef 0:d26c1b55cfca 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
DieterGraef 0:d26c1b55cfca 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
DieterGraef 0:d26c1b55cfca 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
DieterGraef 0:d26c1b55cfca 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
DieterGraef 0:d26c1b55cfca 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
DieterGraef 0:d26c1b55cfca 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
DieterGraef 0:d26c1b55cfca 25 * OF SUCH DAMAGE.
DieterGraef 0:d26c1b55cfca 26 *
DieterGraef 0:d26c1b55cfca 27 * This file is part of the lwIP TCP/IP stack.
DieterGraef 0:d26c1b55cfca 28 *
DieterGraef 0:d26c1b55cfca 29 * Author: Adam Dunkels <adam@sics.se>
DieterGraef 0:d26c1b55cfca 30 *
DieterGraef 0:d26c1b55cfca 31 */
DieterGraef 0:d26c1b55cfca 32 #ifndef __CC_H__
DieterGraef 0:d26c1b55cfca 33 #define __CC_H__
DieterGraef 0:d26c1b55cfca 34
DieterGraef 0:d26c1b55cfca 35 #include <stdint.h>
DieterGraef 0:d26c1b55cfca 36 #include <stddef.h>
DieterGraef 0:d26c1b55cfca 37 /* Types based on stdint.h */
DieterGraef 0:d26c1b55cfca 38 typedef uint8_t u8_t;
DieterGraef 0:d26c1b55cfca 39 typedef int8_t s8_t;
DieterGraef 0:d26c1b55cfca 40 typedef uint16_t u16_t;
DieterGraef 0:d26c1b55cfca 41 typedef int16_t s16_t;
DieterGraef 0:d26c1b55cfca 42 typedef uint32_t u32_t;
DieterGraef 0:d26c1b55cfca 43 typedef int32_t s32_t;
DieterGraef 0:d26c1b55cfca 44 typedef uintptr_t mem_ptr_t;
DieterGraef 0:d26c1b55cfca 45
DieterGraef 0:d26c1b55cfca 46 /* Define (sn)printf formatters for these lwIP types */
DieterGraef 0:d26c1b55cfca 47 #define U16_F "hu"
DieterGraef 0:d26c1b55cfca 48 #define S16_F "hd"
DieterGraef 0:d26c1b55cfca 49 #define X16_F "hx"
DieterGraef 0:d26c1b55cfca 50 #define U32_F "lu"
DieterGraef 0:d26c1b55cfca 51 #define S32_F "ld"
DieterGraef 0:d26c1b55cfca 52 #define X32_F "lx"
DieterGraef 0:d26c1b55cfca 53 #define SZT_F "uz"
DieterGraef 0:d26c1b55cfca 54
DieterGraef 0:d26c1b55cfca 55 /* ARM/LPC17xx is little endian only */
DieterGraef 0:d26c1b55cfca 56 #define BYTE_ORDER LITTLE_ENDIAN
DieterGraef 0:d26c1b55cfca 57
DieterGraef 0:d26c1b55cfca 58 /* Use LWIP error codes */
DieterGraef 0:d26c1b55cfca 59 #define LWIP_PROVIDE_ERRNO
DieterGraef 0:d26c1b55cfca 60
DieterGraef 0:d26c1b55cfca 61 #if defined(__arm__) && defined(__ARMCC_VERSION)
DieterGraef 0:d26c1b55cfca 62 /* Keil uVision4 tools */
DieterGraef 0:d26c1b55cfca 63 #define PACK_STRUCT_BEGIN __packed
DieterGraef 0:d26c1b55cfca 64 #define PACK_STRUCT_STRUCT
DieterGraef 0:d26c1b55cfca 65 #define PACK_STRUCT_END
DieterGraef 0:d26c1b55cfca 66 #define PACK_STRUCT_FIELD(fld) fld
DieterGraef 0:d26c1b55cfca 67 #define ALIGNED(n) __align(n)
DieterGraef 0:d26c1b55cfca 68 #elif defined (__IAR_SYSTEMS_ICC__)
DieterGraef 0:d26c1b55cfca 69 /* IAR Embedded Workbench tools */
DieterGraef 0:d26c1b55cfca 70 #define PACK_STRUCT_BEGIN __packed
DieterGraef 0:d26c1b55cfca 71 #define PACK_STRUCT_STRUCT
DieterGraef 0:d26c1b55cfca 72 #define PACK_STRUCT_END
DieterGraef 0:d26c1b55cfca 73 #define PACK_STRUCT_FIELD(fld) fld
DieterGraef 0:d26c1b55cfca 74 #define IAR_STR(a) #a
DieterGraef 0:d26c1b55cfca 75 #define ALIGNED(n) _Pragma(IAR_STR(data_alignment= ## n ##))
DieterGraef 0:d26c1b55cfca 76 #else
DieterGraef 0:d26c1b55cfca 77 /* GCC tools (CodeSourcery) */
DieterGraef 0:d26c1b55cfca 78 #define PACK_STRUCT_BEGIN
DieterGraef 0:d26c1b55cfca 79 #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
DieterGraef 0:d26c1b55cfca 80 #define PACK_STRUCT_END
DieterGraef 0:d26c1b55cfca 81 #define PACK_STRUCT_FIELD(fld) fld
DieterGraef 0:d26c1b55cfca 82 #define ALIGNED(n) __attribute__((aligned (n)))
DieterGraef 0:d26c1b55cfca 83 #endif
DieterGraef 0:d26c1b55cfca 84
DieterGraef 0:d26c1b55cfca 85 /* Provide Thumb-2 routines for GCC to improve performance */
DieterGraef 0:d26c1b55cfca 86 #if defined(TOOLCHAIN_GCC) && defined(__thumb2__)
DieterGraef 0:d26c1b55cfca 87 #define MEMCPY(dst,src,len) thumb2_memcpy(dst,src,len)
DieterGraef 0:d26c1b55cfca 88 #define LWIP_CHKSUM thumb2_checksum
DieterGraef 0:d26c1b55cfca 89 /* Set algorithm to 0 so that unused lwip_standard_chksum function
DieterGraef 0:d26c1b55cfca 90 doesn't generate compiler warning */
DieterGraef 0:d26c1b55cfca 91 #define LWIP_CHKSUM_ALGORITHM 0
DieterGraef 0:d26c1b55cfca 92
DieterGraef 0:d26c1b55cfca 93 void* thumb2_memcpy(void* pDest, const void* pSource, size_t length);
DieterGraef 0:d26c1b55cfca 94 u16_t thumb2_checksum(void* pData, int length);
DieterGraef 0:d26c1b55cfca 95 #else
DieterGraef 0:d26c1b55cfca 96 /* Used with IP headers only */
DieterGraef 0:d26c1b55cfca 97 #define LWIP_CHKSUM_ALGORITHM 1
DieterGraef 0:d26c1b55cfca 98 #endif
DieterGraef 0:d26c1b55cfca 99
DieterGraef 0:d26c1b55cfca 100
DieterGraef 0:d26c1b55cfca 101 #ifdef LWIP_DEBUG
DieterGraef 0:d26c1b55cfca 102
DieterGraef 0:d26c1b55cfca 103 #include "stdio.h"
DieterGraef 0:d26c1b55cfca 104
DieterGraef 0:d26c1b55cfca 105 void assert_printf(char *msg, int line, char *file);
DieterGraef 0:d26c1b55cfca 106
DieterGraef 0:d26c1b55cfca 107 /* Plaform specific diagnostic output */
DieterGraef 0:d26c1b55cfca 108 #define LWIP_PLATFORM_DIAG(vars) printf vars
DieterGraef 0:d26c1b55cfca 109 #define LWIP_PLATFORM_ASSERT(flag) { assert_printf((flag), __LINE__, __FILE__); }
DieterGraef 0:d26c1b55cfca 110 #else
DieterGraef 0:d26c1b55cfca 111 #define LWIP_PLATFORM_DIAG(msg) { ; }
DieterGraef 0:d26c1b55cfca 112 #define LWIP_PLATFORM_ASSERT(flag) { ; }
DieterGraef 0:d26c1b55cfca 113 #endif
DieterGraef 0:d26c1b55cfca 114
DieterGraef 0:d26c1b55cfca 115 #include "cmsis.h"
DieterGraef 0:d26c1b55cfca 116 #define LWIP_PLATFORM_HTONS(x) __REV16(x)
DieterGraef 0:d26c1b55cfca 117 #define LWIP_PLATFORM_HTONL(x) __REV(x)
DieterGraef 0:d26c1b55cfca 118
DieterGraef 0:d26c1b55cfca 119 #endif /* __CC_H__ */