Skip to content

Commit ca844fd

Browse files
Ron EldorRon Eldor
authored andcommitted
port CC to IAR
1. Add the compiled CC libraries for IAR toolchain 2. modify `ssi_pal_compiler.h` to support IAR
1 parent 56df468 commit ca844fd

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

features/mbedtls/targets/TARGET_CRYPTOCELL310/include/ssi_pal_compiler.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,47 @@
136136
/*! Assertion. */
137137
#define SASI_ASSERT_CONCAT_(a, b) a##b
138138
#define SASI_ASSERT_CONCAT(a, b) SASI_ASSERT_CONCAT_(a, b)
139+
#define SASI_PAL_COMPILER_ASSERT(cond, message) \
140+
enum { SASI_ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(cond)) }
141+
#elif defined(__ICCARM__)
142+
143+
/************************ Defines ******************************/
144+
145+
/*! Associate a symbol with a link section. */
146+
#define SASI_PAL_COMPILER_SECTION(sectionName) __attribute__((section(sectionName)))
147+
148+
/*! Mark symbol as used, i.e., prevent garbage collector from dropping it. */
149+
#define SASI_PAL_COMPILER_KEEP_SYMBOL __attribute__((used))
150+
151+
152+
#define STRING_PRAGMA(x) _Pragma(#x)
153+
/*! Make given data item aligned (alignment in bytes). Not implemented */
154+
/* Used in crys_rsa_types.h. This is telling the compiler about buffer alignment. */
155+
/* IAR treats alignment a bit different. Nonetheless, this is used only for RSA, which was not ported yet. */
156+
#define SASI_PAL_COMPILER_ALIGN(n)
157+
158+
/*! Mark function that never returns. Not implemented. */
159+
/* Not used anywhere, and probably located due to legacy reasons.*/
160+
#define SASI_PAL_COMPILER_FUNC_NEVER_RETURNS
161+
162+
/* Prevent function from being inlined */
163+
#define SASI_PAL_COMPILER_FUNC_DONT_INLINE STRING_PRAGMA(optimize = no_inline)
164+
165+
/*! Given data type may cast (alias) another data type pointer. */
166+
/* (this is used for "superclass" struct casting). Not implemented */
167+
/* Used in crys_rsa_local.h. for some compilers it translates to __may_alias__. */
168+
/* For IAR, there is probably no need for this attribute, as the typedef */
169+
/* is equivalent. Nonetheless, this is RSA code, which was not yet ported to Mbed TLS.*/
170+
#define SASI_PAL_COMPILER_TYPE_MAY_ALIAS
171+
172+
/*! Get sizeof for a structure type member. */
173+
#define SASI_PAL_COMPILER_SIZEOF_STRUCT_MEMBER(type_name, member_name) \
174+
sizeof(((type_name *)0)->member_name)
175+
176+
/*! Assertion. */
177+
#define SASI_ASSERT_CONCAT_(a, b) a##b
178+
#define SASI_ASSERT_CONCAT(a, b) SASI_ASSERT_CONCAT_(a, b)
179+
139180
#define SASI_PAL_COMPILER_ASSERT(cond, message) \
140181
enum { SASI_ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(cond)) }
141182
#else

0 commit comments

Comments
 (0)