Skip to content

Commit 86c6d63

Browse files
committed
IAR support for ethernet library
1 parent 83f6c17 commit 86c6d63

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

libraries/net/lwip/lwip-sys/arch/cc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ typedef uintptr_t mem_ptr_t;
7171
#define PACK_STRUCT_STRUCT
7272
#define PACK_STRUCT_END
7373
#define PACK_STRUCT_FIELD(fld) fld
74-
// #define PACK_STRUCT_USE_INCLUDES
75-
#error NEEDS ALIGNED // FIXME TBD
74+
#define IAR_STR(a) #a
75+
#define ALIGNED(n) _Pragma(IAR_STR(data_alignment= ## n ##))
7676
#else
7777
/* GCC tools (CodeSourcery) */
7878
#define PACK_STRUCT_BEGIN

libraries/net/lwip/lwip-sys/arch/sys_arch.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,11 @@ sys_thread_t sys_thread_new(const char *pcName,
427427
t->def.tpriority = (osPriority)priority;
428428
t->def.stacksize = stacksize;
429429
#ifndef __MBED_CMSIS_RTOS_CA9
430+
#if defined (__ICCARM__)
431+
t->def.stack_pointer = (uint32_t*)malloc(stacksize);
432+
#else
430433
t->def.stack_pointer = (unsigned char*)malloc(stacksize);
434+
#endif
431435
if (t->def.stack_pointer == NULL) {
432436
error("Error allocating the stack memory");
433437
}

libraries/tests/net/protocols/NTPClient_HelloWorld/NTPClient/NTPClient.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class NTPClient
6161
NTPResult setTime(const char* host, uint16_t port = NTP_DEFAULT_PORT, uint32_t timeout = NTP_DEFAULT_TIMEOUT); //Blocking
6262

6363
private:
64+
#if defined (__ICCARM__)
65+
#pragma pack()
66+
#endif
6467
struct NTPPacket //See RFC 4330 for Simple NTP
6568
{
6669
//WARN: We are in LE! Network is BE!
@@ -86,7 +89,11 @@ class NTPClient
8689
uint32_t rxTm_f;
8790
uint32_t txTm_s;
8891
uint32_t txTm_f;
92+
#if defined (__ICCARM__)
93+
};
94+
#else
8995
} __attribute__ ((packed));
96+
#endif
9097

9198
UDPSocket m_sock;
9299
};

0 commit comments

Comments
 (0)