Skip to content

Commit 7ed00a0

Browse files
committed
Merge pull request #123 from c1728p9/iar_support
Add IAR support
2 parents 8a6e9c3 + 14e235a commit 7ed00a0

File tree

8 files changed

+57
-20
lines changed

8 files changed

+57
-20
lines changed

core/configuration-store.lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/ARMmbed/configuration-store/#f0a4c07cce8c84513f528e5939c5a1469385d2a8
1+
https://github.com/ARMmbed/configuration-store/#479cd1f033828d1577669d1f01eb56ce6f559cfd

frameworks/utest/utest/shim.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
# ifndef __deprecated_message
3131
# if defined(__CC_ARM)
3232
# define __deprecated_message(msg) __attribute__((deprecated))
33+
# elif defined (__ICCARM__)
34+
# define __deprecated_message(msg)
3335
# else
3436
# define __deprecated_message(msg) __attribute__((deprecated(msg)))
3537
# endif
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the License); you may
5+
* not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <stdarg.h>
18+
#include <stdint.h>
19+
#include <stdio.h>
20+
#include <string.h>
21+
22+
#include "mbed_error.h"
23+
24+
size_t BufferedSerialThunk(void *buf_serial, const void *s, size_t length);
25+
26+
int BufferedPrintfC(void *stream, int size, const char* format, va_list arg)
27+
{
28+
int r;
29+
char buffer[size];
30+
memset(buffer, 0, size);
31+
r = vsprintf(buffer, format, arg);
32+
// this may not hit the heap but should alert the user anyways
33+
if(r > (int32_t) size) {
34+
error("%s %d buffer overwrite (max_buf_size: %d exceeded: %d)!\r\n", __FILE__, __LINE__, size, r);
35+
return 0;
36+
}
37+
if ( r > 0 ) {
38+
BufferedSerialThunk(stream, buffer, r);
39+
}
40+
return r;
41+
}

net/ESP8266Interface/ESP8266/ATParser/BufferedSerial/BufferedSerial.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include "BufferedSerial.h"
2424
#include <stdarg.h>
2525

26+
extern "C" int BufferedPrintfC(void *stream, int size, const char* format, va_list arg);
27+
2628
BufferedSerial::BufferedSerial(PinName tx, PinName rx, uint32_t buf_size, uint32_t tx_multiple, const char* name)
2729
: RawSerial(tx, rx) , _rxbuf(buf_size), _txbuf((uint32_t)(tx_multiple*buf_size))
2830
{
@@ -79,26 +81,18 @@ int BufferedSerial::puts(const char *s)
7981
return 0;
8082
}
8183

82-
int BufferedSerial::printf(const char* format, ...)
84+
extern "C" size_t BufferedSerialThunk(void *buf_serial, const void *s, size_t length)
8385
{
84-
char buffer[this->_buf_size];
85-
memset(buffer,0,this->_buf_size);
86-
int r = 0;
86+
BufferedSerial *buffered_serial = (BufferedSerial *)buf_serial;
87+
return buffered_serial->write(s, length);
88+
}
8789

90+
int BufferedSerial::printf(const char* format, ...)
91+
{
8892
va_list arg;
8993
va_start(arg, format);
90-
r = vsprintf(buffer, format, arg);
91-
// this may not hit the heap but should alert the user anyways
92-
if(r > (int32_t) this->_buf_size) {
93-
error("%s %d buffer overwrite (max_buf_size: %d exceeded: %d)!\r\n", __FILE__, __LINE__,this->_buf_size,r);
94-
va_end(arg);
95-
return 0;
96-
}
94+
int r = BufferedPrintfC((void*)this, this->_buf_size, format, arg);
9795
va_end(arg);
98-
if ( r > 0 ) {
99-
r = BufferedSerial::write(buffer, r);
100-
}
101-
10296
return r;
10397
}
10498

net/atmel-rf-driver.lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/ARMmbed/atmel-rf-driver-mirror/#473759f1a37c1863cb2adfcb2a87ac3f1da144ed
1+
https://github.com/ARMmbed/atmel-rf-driver-mirror/#1583e99e11640986f5c0de272a21bc9143b4a1a8

net/mbed-client.lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/ARMmbed/mbed-client-mirror/#6bfb6655b47f0ede4cc278c6c5f933ecefaf136d
1+
https://github.com/ARMmbed/mbed-client-mirror/#0b66c1a11638949391c67775ec0b8a42e88a9dfe

net/mbed-mesh-api.lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/ARMmbed/mbed-mesh-api-mirror/#7312d7621c5c6b89f7c0476a2b103a9f1ea71c3c
1+
https://github.com/ARMmbed/mbed-mesh-api-mirror/#8ceb56d87cd20d26d4db71aa42a2860cfaccaf9c

tools/toolchains/iar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
149149
cmd = [self.ld, "-o", output, "--skip_dynamic_initialization", "--map=%s" % map_file] + objects + libraries
150150

151151
if mem_map:
152-
args.extend(["--config", mem_map])
152+
cmd.extend(["--config", mem_map])
153153

154154
# Call cmdline hook
155155
cmd = self.hook.get_cmdline_linker(cmd)

0 commit comments

Comments
 (0)