Merge pull request #123 from c1728p9/iar_support

Add IAR support
Martin Kojtal 2016-05-25 07:43:16 +01:00
commit 7ed00a0e62
8 changed files with 57 additions and 20 deletions

View File

@ -1 +1 @@
https://github.com/ARMmbed/configuration-store/#f0a4c07cce8c84513f528e5939c5a1469385d2a8
https://github.com/ARMmbed/configuration-store/#479cd1f033828d1577669d1f01eb56ce6f559cfd

View File

@ -30,6 +30,8 @@
# ifndef __deprecated_message
# if defined(__CC_ARM)
# define __deprecated_message(msg) __attribute__((deprecated))
# elif defined (__ICCARM__)
# define __deprecated_message(msg)
# else
# define __deprecated_message(msg) __attribute__((deprecated(msg)))
# endif

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "mbed_error.h"
size_t BufferedSerialThunk(void *buf_serial, const void *s, size_t length);
int BufferedPrintfC(void *stream, int size, const char* format, va_list arg)
{
int r;
char buffer[size];
memset(buffer, 0, size);
r = vsprintf(buffer, format, arg);
// this may not hit the heap but should alert the user anyways
if(r > (int32_t) size) {
error("%s %d buffer overwrite (max_buf_size: %d exceeded: %d)!\r\n", __FILE__, __LINE__, size, r);
return 0;
}
if ( r > 0 ) {
BufferedSerialThunk(stream, buffer, r);
}
return r;
}

View File

@ -23,6 +23,8 @@
#include "BufferedSerial.h"
#include <stdarg.h>
extern "C" int BufferedPrintfC(void *stream, int size, const char* format, va_list arg);
BufferedSerial::BufferedSerial(PinName tx, PinName rx, uint32_t buf_size, uint32_t tx_multiple, const char* name)
: RawSerial(tx, rx) , _rxbuf(buf_size), _txbuf((uint32_t)(tx_multiple*buf_size))
{
@ -79,26 +81,18 @@ int BufferedSerial::puts(const char *s)
return 0;
}
extern "C" size_t BufferedSerialThunk(void *buf_serial, const void *s, size_t length)
{
BufferedSerial *buffered_serial = (BufferedSerial *)buf_serial;
return buffered_serial->write(s, length);
}
int BufferedSerial::printf(const char* format, ...)
{
char buffer[this->_buf_size];
memset(buffer,0,this->_buf_size);
int r = 0;
va_list arg;
va_start(arg, format);
r = vsprintf(buffer, format, arg);
// this may not hit the heap but should alert the user anyways
if(r > (int32_t) this->_buf_size) {
error("%s %d buffer overwrite (max_buf_size: %d exceeded: %d)!\r\n", __FILE__, __LINE__,this->_buf_size,r);
va_end(arg);
return 0;
}
int r = BufferedPrintfC((void*)this, this->_buf_size, format, arg);
va_end(arg);
if ( r > 0 ) {
r = BufferedSerial::write(buffer, r);
}
return r;
}

View File

@ -1 +1 @@
https://github.com/ARMmbed/atmel-rf-driver-mirror/#473759f1a37c1863cb2adfcb2a87ac3f1da144ed
https://github.com/ARMmbed/atmel-rf-driver-mirror/#1583e99e11640986f5c0de272a21bc9143b4a1a8

View File

@ -1 +1 @@
https://github.com/ARMmbed/mbed-client-mirror/#6bfb6655b47f0ede4cc278c6c5f933ecefaf136d
https://github.com/ARMmbed/mbed-client-mirror/#0b66c1a11638949391c67775ec0b8a42e88a9dfe

View File

@ -1 +1 @@
https://github.com/ARMmbed/mbed-mesh-api-mirror/#7312d7621c5c6b89f7c0476a2b103a9f1ea71c3c
https://github.com/ARMmbed/mbed-mesh-api-mirror/#8ceb56d87cd20d26d4db71aa42a2860cfaccaf9c

View File

@ -149,7 +149,7 @@ class IAR(mbedToolchain):
cmd = [self.ld, "-o", output, "--skip_dynamic_initialization", "--map=%s" % map_file] + objects + libraries
if mem_map:
args.extend(["--config", mem_map])
cmd.extend(["--config", mem_map])
# Call cmdline hook
cmd = self.hook.get_cmdline_linker(cmd)