Merge pull request #5184 from ARMmbed/release-candidate

Release candidate for mbed-os-5.6.1
pull/5394/head mbed_lib_rev152
Martin Kojtal 2017-09-27 12:45:48 +01:00 committed by GitHub
commit cc7556a92f
72 changed files with 1593 additions and 678 deletions

View File

@ -1,6 +1,5 @@
python:
- "2.7"
group: deprecated-2017Q3
script:
- mkdir BUILD
# Assert that the Doxygen build produced no warnings.
@ -36,10 +35,10 @@ before_install:
- python --version
- doxygen --version
install:
- pip install -r requirements.txt
- pip install pytest
- pip install pylint
- pip install hypothesis
- pip install mock
- pip install coverage
- pip install coveralls
- pip install --user -r requirements.txt
- pip install --user pytest
- pip install --user pylint
- pip install --user hypothesis
- pip install --user mock
- pip install --user coverage
- pip install --user coveralls

View File

@ -23,7 +23,6 @@
#include "greentea-client/test_env.h"
#include "mbed.h"
#include "us_ticker_api.h"
using namespace utest::v1;
@ -42,6 +41,7 @@ void cb_done() {
void lp_timeout_1s_deepsleep(void)
{
complete = false;
LowPowerTimer timer;
/*
* Since deepsleep() may shut down the UART peripheral, we wait for 10ms
@ -54,33 +54,32 @@ void lp_timeout_1s_deepsleep(void)
wait_ms(10);
/*
* We use here lp_ticker_read() instead of us_ticker_read() for start and
* We use here the low power timer instead of microsecond timer for start and
* end because the microseconds timer might be disable during deepsleep.
*/
timestamp_t start = lp_ticker_read();
timer.start();
lpt.attach(&cb_done, 1);
deepsleep();
while (!complete);
timestamp_t end = lp_ticker_read();
/* It takes longer to wake up from deep sleep */
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, end - start);
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, timer.read_us());
TEST_ASSERT_TRUE(complete);
}
void lp_timeout_1s_sleep(void)
{
complete = false;
Timer timer;
timer.start();
sleep_manager_lock_deep_sleep();
timestamp_t start = us_ticker_read();
lpt.attach(&cb_done, 1);
sleep();
while (!complete);
timestamp_t end = us_ticker_read();
sleep_manager_unlock_deep_sleep();
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, end - start);
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, timer.read_us());
TEST_ASSERT_TRUE(complete);
}
#endif /* DEVICE_SLEEP */
@ -88,14 +87,14 @@ void lp_timeout_1s_sleep(void)
void lp_timeout_us(uint32_t delay_us, uint32_t tolerance)
{
complete = false;
Timer timer;
timer.start();
timestamp_t start = us_ticker_read();
lpt.attach_us(&cb_done, delay_us);
while (!complete);
timestamp_t end = us_ticker_read();
/* Using RTC which is less accurate */
TEST_ASSERT_UINT32_WITHIN(tolerance, delay_us, end - start);
TEST_ASSERT_UINT32_WITHIN(tolerance, delay_us, timer.read_us());
TEST_ASSERT_TRUE(complete);
}

View File

@ -22,7 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#if !defined(MBED_HEAP_STATS_ENABLED) || !MBED_HEAP_STATS_ENABLED || defined(__ICCARM__)
#if !defined(MBED_HEAP_STATS_ENABLED)
#error [NOT_SUPPORTED] test not supported
#endif

View File

@ -23,17 +23,16 @@
#include "greentea-client/test_env.h"
#include "mbed.h"
#include "us_ticker_api.h"
#include "lp_ticker_api.h"
#include "TimerEvent.h"
using namespace utest::v1;
static volatile bool complete;
static volatile timestamp_t complete_timestamp;
static volatile timestamp_t complete_time;
static ticker_event_t delay_event;
static const ticker_data_t *lp_ticker_data = get_lp_ticker_data();
static Timer timer;
static LowPowerTimer lp_timer;
/* Timeouts are quite arbitrary due to large number of boards with varying level of accuracy */
#define LONG_TIMEOUT (100000)
@ -41,7 +40,7 @@ static const ticker_data_t *lp_ticker_data = get_lp_ticker_data();
void cb_done(uint32_t id) {
if ((uint32_t)&delay_event == id) {
complete_timestamp = us_ticker_read();
complete_time = timer.read_us();
complete = true;
} else {
// Normal ticker handling
@ -51,7 +50,7 @@ void cb_done(uint32_t id) {
void cb_done_deepsleep(uint32_t id) {
if ((uint32_t)&delay_event == id) {
complete_timestamp = lp_ticker_read();
complete_time = lp_timer.read_us();
complete = true;
} else {
// Normal ticker handling
@ -66,14 +65,15 @@ void lp_ticker_delay_us(uint32_t delay_us, uint32_t tolerance)
ticker_set_handler(lp_ticker_data, cb_done);
ticker_remove_event(lp_ticker_data, &delay_event);
delay_ts = lp_ticker_read() + delay_us;
delay_ts = ticker_read(lp_ticker_data) + delay_us;
timestamp_t start = us_ticker_read();
timer.reset();
timer.start();
ticker_insert_event(lp_ticker_data, &delay_event, delay_ts, (uint32_t)&delay_event);
while (!complete);
timestamp_t end = complete_timestamp;
timer.stop();
TEST_ASSERT_UINT32_WITHIN(tolerance, delay_us, end - start);
TEST_ASSERT_UINT32_WITHIN(tolerance, delay_us, complete_time);
TEST_ASSERT_TRUE(complete);
}
@ -95,19 +95,20 @@ void lp_ticker_1s_deepsleep()
ticker_set_handler(lp_ticker_data, cb_done_deepsleep);
ticker_remove_event(lp_ticker_data, &delay_event);
delay_ts = lp_ticker_read() + 1000000;
delay_ts = ticker_read(lp_ticker_data) + 1000000;
/*
* We use here lp_ticker_read() instead of us_ticker_read() for start and
* We use here the low power timer instead of microsecond timer for start and
* end because the microseconds timer might be disable during deepsleep.
*/
timestamp_t start = lp_ticker_read();
lp_timer.reset();
lp_timer.start();
ticker_insert_event(lp_ticker_data, &delay_event, delay_ts, (uint32_t)&delay_event);
deepsleep();
while (!complete);
timestamp_t end = complete_timestamp;
lp_timer.stop();
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, end - start);
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, complete_time);
TEST_ASSERT_TRUE(complete);
}
@ -118,17 +119,18 @@ void lp_ticker_1s_sleep()
ticker_set_handler(lp_ticker_data, cb_done);
ticker_remove_event(lp_ticker_data, &delay_event);
delay_ts = lp_ticker_read() + 1000000;
delay_ts = ticker_read(lp_ticker_data) + 1000000;
sleep_manager_lock_deep_sleep();
timestamp_t start = us_ticker_read();
timer.reset();
timer.start();
ticker_insert_event(lp_ticker_data, &delay_event, delay_ts, (uint32_t)&delay_event);
sleep();
while (!complete);
timestamp_t end = complete_timestamp;
timer.stop();
sleep_manager_unlock_deep_sleep();
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, end - start);
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, complete_time);
TEST_ASSERT_TRUE(complete);
}
#endif /* DEVICE_SLEEP */

View File

@ -191,11 +191,12 @@ void test_dual_thread_lock_trylock_thread(Mutex *mutex)
void test_dual_thread_lock_lock_thread(Mutex *mutex)
{
uint32_t start = us_ticker_read();
Timer timer;
timer.start();
osStatus stat = mutex->lock(TEST_DELAY);
TEST_ASSERT_EQUAL(osErrorTimeout, stat);
TEST_ASSERT_UINT32_WITHIN(5000, TEST_DELAY*1000, us_ticker_read() - start);
TEST_ASSERT_UINT32_WITHIN(5000, TEST_DELAY*1000, timer.read_us());
}
/** Test dual thread lock

View File

@ -135,11 +135,12 @@ void test_get_empty_no_timeout()
void test_get_empty_timeout()
{
Queue<uint32_t, 1> q;
uint32_t start = us_ticker_read();
Timer timer;
timer.start();
osEvent evt = q.get(50);
TEST_ASSERT_EQUAL(osEventTimeout, evt.status);
TEST_ASSERT_UINT32_WITHIN(5000, 50000, us_ticker_read() - start);
TEST_ASSERT_UINT32_WITHIN(5000, 50000, timer.read_us());
}
/** Test get empty wait forever
@ -157,12 +158,13 @@ void test_get_empty_wait_forever()
t.start(callback(thread_put_uint_msg<TEST_TIMEOUT>, &q));
uint32_t start = us_ticker_read();
Timer timer;
timer.start();
osEvent evt = q.get();
TEST_ASSERT_EQUAL(osEventMessage, evt.status);
TEST_ASSERT_EQUAL(TEST_UINT_MSG, evt.value.v);
TEST_ASSERT_UINT32_WITHIN(TEST_TIMEOUT * 100, TEST_TIMEOUT * 1000, us_ticker_read() - start);
TEST_ASSERT_UINT32_WITHIN(TEST_TIMEOUT * 100, TEST_TIMEOUT * 1000, timer.read_us());
}
/** Test put full no timeout
@ -195,11 +197,12 @@ void test_put_full_timeout()
osStatus stat = q.put((uint32_t*) TEST_UINT_MSG, TEST_TIMEOUT);
TEST_ASSERT_EQUAL(osOK, stat);
uint32_t start = us_ticker_read();
Timer timer;
timer.start();
stat = q.put((uint32_t*) TEST_UINT_MSG, TEST_TIMEOUT);
TEST_ASSERT_EQUAL(osErrorTimeout, stat);
TEST_ASSERT_UINT32_WITHIN(TEST_TIMEOUT * 100, TEST_TIMEOUT * 1000, us_ticker_read() - start);
TEST_ASSERT_UINT32_WITHIN(TEST_TIMEOUT * 100, TEST_TIMEOUT * 1000, timer.read_us());
}
/** Test put full wait forever
@ -220,10 +223,11 @@ void test_put_full_waitforever()
osStatus stat = q.put((uint32_t*) TEST_UINT_MSG);
TEST_ASSERT_EQUAL(osOK, stat);
uint32_t start = us_ticker_read();
Timer timer;
timer.start();
stat = q.put((uint32_t*) TEST_UINT_MSG, osWaitForever);
TEST_ASSERT_EQUAL(osOK, stat);
TEST_ASSERT_UINT32_WITHIN(TEST_TIMEOUT * 100, TEST_TIMEOUT * 1000, us_ticker_read() - start);
TEST_ASSERT_UINT32_WITHIN(TEST_TIMEOUT * 100, TEST_TIMEOUT * 1000, timer.read_us());
t.join();
}

View File

@ -152,7 +152,8 @@ void test_timeout()
Semaphore sem(0);
osStatus res;
uint32_t start = us_ticker_read();
Timer timer;
timer.start();
res = t.start(callback(timeout_thread, &sem));
TEST_ASSERT_EQUAL(osOK, res);
Thread::wait(SHORT_WAIT);
@ -160,7 +161,7 @@ void test_timeout()
TEST_ASSERT_EQUAL(Thread::WaitingSemaphore, t.get_state());
t.join();
TEST_ASSERT_UINT32_WITHIN(5000, 30000, us_ticker_read() - start);
TEST_ASSERT_UINT32_WITHIN(5000, 30000, timer.read_us());
}
/** Test no timeouts
@ -180,12 +181,13 @@ void test_no_timeout()
{
Semaphore sem(T);
uint32_t start = us_ticker_read();
Timer timer;
timer.start();
int32_t cnt = sem.wait(0);
TEST_ASSERT_EQUAL(T, cnt);
TEST_ASSERT_UINT32_WITHIN(5000, 0, us_ticker_read() - start);
TEST_ASSERT_UINT32_WITHIN(5000, 0, timer.read_us());
}
/** Test multiple tokens wait

View File

@ -377,11 +377,12 @@ void test_thread_stack_info() {
then the thread sleeps for given amount of time
*/
void test_thread_wait() {
uint32_t start = us_ticker_read();
Timer timer;
timer.start();
Thread::wait(150);
TEST_ASSERT_UINT32_WITHIN(50000, 150000, us_ticker_read() - start);
TEST_ASSERT_UINT32_WITHIN(50000, 150000, timer.read_us());
}
/** Testing thread name
@ -656,7 +657,7 @@ void test_thread_prio() {
}
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(15, "default_auto");
GREENTEA_SETUP(20, "default_auto");
return verbose_test_setup_handler(number_of_cases);
}

View File

@ -112,6 +112,7 @@ public:
/** Get the program page size
*
* The page size defines the writable page size
* @return Size of a program page in bytes
*/
uint32_t get_page_size() const;

View File

@ -91,7 +91,26 @@ public:
* @param size Size to erase in bytes, must be a multiple of erase block size
* @return 0 on success, negative error code on failure
*/
virtual int erase(bd_addr_t addr, bd_size_t size) = 0;
virtual int erase(bd_addr_t addr, bd_size_t size)
{
return 0;
}
/** Mark blocks as no longer in use
*
* This function provides a hint to the underlying block device that a region of blocks
* is no longer in use and may be erased without side effects. Erase must still be called
* before programming, but trimming allows flash-translation-layers to schedule erases when
* the device is not busy.
*
* @param addr Address of block to mark as unused
* @param size Size to mark as unused in bytes, must be a multiple of erase block size
* @return 0 on success, negative error code on failure
*/
virtual int trim(bd_addr_t addr, bd_size_t size)
{
return 0;
}
/** Get the size of a readable block
*
@ -111,7 +130,10 @@ public:
* @return Size of a eraseable block in bytes
* @note Must be a multiple of the program size
*/
virtual bd_size_t get_erase_size() const = 0;
virtual bd_size_t get_erase_size() const
{
return get_program_size();
}
/** Get the total size of the underlying device
*

View File

@ -171,7 +171,7 @@
/ disk_ioctl() function. */
#define _USE_TRIM 0
#define _USE_TRIM 1
/* This option switches ATA-TRIM feature. (0:Disable or 1:Enable)
/ To enable Trim feature, also CTRL_TRIM command should be implemented to the
/ disk_ioctl() function. */

View File

@ -244,6 +244,15 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
case GET_BLOCK_SIZE:
*((DWORD*)buff) = 1; // default when not known
return RES_OK;
case CTRL_TRIM:
if (_ffs[pdrv] == NULL) {
return RES_NOTRDY;
} else {
DWORD *sectors = (DWORD*)buff;
DWORD ssize = disk_get_sector_size(pdrv);
int err = _ffs[pdrv]->trim(sectors[0]*ssize, (sectors[1]-sectors[0]+1)*ssize);
return err ? RES_PARERR : RES_OK;
}
}
return RES_PARERR;

View File

@ -20,14 +20,14 @@
#ifndef MBEDTLS_DEVICE_H
#define MBEDTLS_DEVICE_H
/* FIXME: Don't enable AES hardware acceleration until issue #4928 is fixed.
* (https://github.com/ARMmbed/mbed-os/issues/4928) */
/* #define MBEDTLS_AES_ALT */
#define MBEDTLS_AES_ALT
#define MBEDTLS_SHA256_ALT
/* FIXME: Don't enable SHA1, SHA256 and MD5 hardware acceleration until issue
* #5079 is fixed. (https://github.com/ARMmbed/mbed-os/issues/5079) */
/* #define MBEDTLS_SHA256_ALT */
#define MBEDTLS_SHA1_ALT
/* #define MBEDTLS_SHA1_ALT */
#define MBEDTLS_MD5_ALT
/* #define MBEDTLS_MD5_ALT */
#endif /* MBEDTLS_DEVICE_H */

View File

@ -1,5 +1,5 @@
/*
* Hardware aes collector for the STM32F4 family
* Hardware aes implementation for STM32F4 STM32F7 and STM32L4 families
*******************************************************************************
* Copyright (c) 2017, STMicroelectronics
* SPDX-License-Identifier: Apache-2.0
@ -129,15 +129,18 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
/* allow multi-instance of CRYP use: restore context for CRYP hw module */
ctx->hcryp_aes.Instance->CR = ctx->ctx_save_cr;
ctx->hcryp_aes.Phase = HAL_CRYP_PHASE_READY;
ctx->hcryp_aes.Init.DataType = CRYP_DATATYPE_8B;
ctx->hcryp_aes.Init.pKey = ctx->aes_key;
if(mode == MBEDTLS_AES_DECRYPT) { /* AES decryption */
ctx->hcryp_aes.Init.DataType = CRYP_DATATYPE_8B;
ctx->hcryp_aes.Init.pKey = ctx->aes_key;
mbedtls_aes_decrypt( ctx, input, output );
if (mbedtls_internal_aes_decrypt( ctx, input, output )){
return ST_ERR_AES_BUSY;
}
} else { /* AES encryption */
ctx->hcryp_aes.Init.DataType = CRYP_DATATYPE_8B;
ctx->hcryp_aes.Init.pKey = ctx->aes_key;
mbedtls_aes_encrypt( ctx, input, output );
if (mbedtls_internal_aes_encrypt( ctx, input, output )) {
return ST_ERR_AES_BUSY;
}
}
/* allow multi-instance of CRYP use: save context for CRYP HW module CR */
ctx->ctx_save_cr = ctx->hcryp_aes.Instance->CR;
@ -147,29 +150,50 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
#if defined(MBEDTLS_CIPHER_MODE_CBC)
#if defined (TARGET_STM32L486xG)
static int st_cbc_restore_context(mbedtls_aes_context *ctx){
uint32_t tickstart;
tickstart = HAL_GetTick();
while((ctx->hcryp_aes.Instance->SR & AES_SR_BUSY) != 0){
if ((HAL_GetTick() - tickstart) > ST_AES_TIMEOUT) {
return ST_ERR_AES_BUSY; // timeout: CRYP processor is busy
}
}
/* allow multi-instance of CRYP use: restore context for CRYP hw module */
ctx->hcryp_aes.Instance->CR = ctx->ctx_save_cr;
return 0;
}
static int st_hal_cryp_cbc( mbedtls_aes_context *ctx, uint32_t opmode, size_t length,
unsigned char iv[16], uint8_t *input, uint8_t *output)
{
int status = 0;
ctx->hcryp_aes.Init.pInitVect = &iv[0]; // used in process, not in the init
if ((ctx->hcryp_aes.Init.OperatingMode != opmode) || \
(ctx->hcryp_aes.Init.ChainingMode != CRYP_CHAINMODE_AES_CBC) || \
(ctx->hcryp_aes.Init.KeyWriteFlag != CRYP_KEY_WRITE_ENABLE)) {
/* At this moment only, we know we have CBC mode: Re-initialize AES
IP with proper parameters and apply key and IV for multi context usecase */
if (HAL_CRYP_DeInit(&ctx->hcryp_aes) != HAL_OK)
return ST_ERR_AES_BUSY;
ctx->hcryp_aes.Init.OperatingMode = opmode;
ctx->hcryp_aes.Init.ChainingMode = CRYP_CHAINMODE_AES_CBC;
ctx->hcryp_aes.Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
if (HAL_CRYP_Init(&ctx->hcryp_aes) != HAL_OK)
return ST_ERR_AES_BUSY;
/* Re-initialize AES IP with proper parameters */
if (HAL_CRYP_DeInit(&ctx->hcryp_aes) != HAL_OK)
return HAL_ERROR;
ctx->hcryp_aes.Init.OperatingMode = opmode;
ctx->hcryp_aes.Init.ChainingMode = CRYP_CHAINMODE_AES_CBC;
ctx->hcryp_aes.Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
if (HAL_CRYP_Init(&ctx->hcryp_aes) != HAL_OK)
return HAL_ERROR;
}
status = HAL_CRYPEx_AES(&ctx->hcryp_aes, input, length, output, 10);
return status;
if(HAL_CRYPEx_AES(&ctx->hcryp_aes, input, length, output, 10) != 0)
return ST_ERR_AES_BUSY;
return 0;
}
#else /* STM32F4 and STM32F7 */
static int st_cbc_restore_context(mbedtls_aes_context *ctx){
/* allow multi-instance of CRYP use: restore context for CRYP hw module */
ctx->hcryp_aes.Instance->CR = ctx->ctx_save_cr;
/* Re-initialize AES processor with proper parameters
and (re-)apply key and IV for multi context usecases */
if (HAL_CRYP_DeInit(&ctx->hcryp_aes) != HAL_OK)
return ST_ERR_AES_BUSY;
if (HAL_CRYP_Init(&ctx->hcryp_aes) != HAL_OK)
return ST_ERR_AES_BUSY;
return 0;
}
#endif /* TARGET_STM32L486xG */
int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
@ -179,25 +203,66 @@ int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
const unsigned char *input,
unsigned char *output )
{
int status = 0;
uint32_t tickstart;
uint32_t *iv_ptr = (uint32_t *)&iv[0];
if( length % 16 )
return( MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH );
#if defined (TARGET_STM32L486xG)
if( mode == MBEDTLS_AES_DECRYPT ) {
status = st_hal_cryp_cbc(ctx, CRYP_ALGOMODE_KEYDERIVATION_DECRYPT, length, iv, (uint8_t *)input, (uint8_t *)output);
} else {
status = st_hal_cryp_cbc(ctx, CRYP_ALGOMODE_ENCRYPT, length, iv, (uint8_t *)input, (uint8_t *)output);
}
#else
ctx->hcryp_aes.Init.pInitVect = &iv[0];
if (st_cbc_restore_context(ctx) != 0)
return (ST_ERR_AES_BUSY);
#if defined (TARGET_STM32L486xG)
if( mode == MBEDTLS_AES_DECRYPT ) {
status = HAL_CRYP_AESCBC_Decrypt(&ctx->hcryp_aes, (uint8_t *)input, length, (uint8_t *)output, 10);
if (st_hal_cryp_cbc(ctx, CRYP_ALGOMODE_KEYDERIVATION_DECRYPT, length, iv, (uint8_t *)input, (uint8_t *)output) != 0)
return ST_ERR_AES_BUSY;
/* Save the internal IV vector for multi context purpose */
tickstart = HAL_GetTick();
while((ctx->hcryp_aes.Instance->SR & AES_SR_BUSY) != 0){
if ((HAL_GetTick() - tickstart) > ST_AES_TIMEOUT) {
return ST_ERR_AES_BUSY; // timeout: CRYP processor is busy
}
}
ctx->ctx_save_cr = ctx->hcryp_aes.Instance->CR; // save here before overwritten
ctx->hcryp_aes.Instance->CR &= ~AES_CR_EN;
*iv_ptr++ = ctx->hcryp_aes.Instance->IVR3;
*iv_ptr++ = ctx->hcryp_aes.Instance->IVR2;
*iv_ptr++ = ctx->hcryp_aes.Instance->IVR1;
*iv_ptr++ = ctx->hcryp_aes.Instance->IVR0;
} else {
status = HAL_CRYP_AESCBC_Encrypt(&ctx->hcryp_aes, (uint8_t *)input, length, (uint8_t *)output, 10);
if (st_hal_cryp_cbc(ctx, CRYP_ALGOMODE_ENCRYPT, length, iv, (uint8_t *)input, (uint8_t *)output) != 0)
return ST_ERR_AES_BUSY;
memcpy( iv, output, 16 ); /* current output is the IV vector for the next call */
ctx->ctx_save_cr = ctx->hcryp_aes.Instance->CR;
}
#else
if( mode == MBEDTLS_AES_DECRYPT ) {
if (HAL_CRYP_AESCBC_Decrypt(&ctx->hcryp_aes, (uint8_t *)input, length, (uint8_t *)output, 10) != HAL_OK)
return ST_ERR_AES_BUSY;
/* Save the internal IV vector for multi context purpose */
tickstart = HAL_GetTick();
while((ctx->hcryp_aes.Instance->SR & (CRYP_SR_IFEM | CRYP_SR_OFNE | CRYP_SR_BUSY)) != CRYP_SR_IFEM){
if ((HAL_GetTick() - tickstart) > ST_AES_TIMEOUT) {
return ST_ERR_AES_BUSY; // timeout: CRYP processor is busy
}
}
ctx->ctx_save_cr = ctx->hcryp_aes.Instance->CR; // save here before overwritten
ctx->hcryp_aes.Instance->CR &= ~CRYP_CR_CRYPEN;
*iv_ptr++ = ctx->hcryp_aes.Instance->IV0LR;
*iv_ptr++ = ctx->hcryp_aes.Instance->IV0RR;
*iv_ptr++ = ctx->hcryp_aes.Instance->IV1LR;
*iv_ptr++ = ctx->hcryp_aes.Instance->IV1RR;
} else {
if (HAL_CRYP_AESCBC_Encrypt(&ctx->hcryp_aes, (uint8_t *)input, length, (uint8_t *)output, 10) != HAL_OK)
return ST_ERR_AES_BUSY;
memcpy( iv, output, 16 ); /* current output is the IV vector for the next call */
ctx->ctx_save_cr = ctx->hcryp_aes.Instance->CR;
}
#endif
return( status );
return 0;
}
#endif /* MBEDTLS_CIPHER_MODE_CBC */
@ -216,7 +281,8 @@ int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
if( mode == MBEDTLS_AES_DECRYPT ) {
while( length-- ) {
if( n == 0 )
mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, iv, iv );
if (mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, iv, iv ) != 0)
return ST_ERR_AES_BUSY;
c = *input++;
*output++ = (unsigned char)( c ^ iv[n] );
@ -227,7 +293,8 @@ int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
} else {
while( length-- ) {
if( n == 0 )
mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, iv, iv );
if (mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, iv, iv ) != 0)
return ST_ERR_AES_BUSY;
iv[n] = *output++ = (unsigned char)( iv[n] ^ *input++ );
@ -253,7 +320,8 @@ int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx,
while( length-- ) {
memcpy( ov, iv, 16 );
mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, iv, iv );
if (mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, iv, iv ) != 0)
return ST_ERR_AES_BUSY;
if( mode == MBEDTLS_AES_DECRYPT )
ov[16] = *input;
@ -286,7 +354,8 @@ int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
while( length-- )
{
if( n == 0 ) {
mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, nonce_counter, stream_block );
if (mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, nonce_counter, stream_block ) != 0)
return ST_ERR_AES_BUSY;
for( i = 16; i > 0; i-- )
if( ++nonce_counter[i - 1] != 0 )
@ -304,26 +373,42 @@ int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
}
#endif /* MBEDTLS_CIPHER_MODE_CTR */
int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] )
{
if (HAL_CRYP_AESECB_Encrypt(&ctx->hcryp_aes, (uint8_t *)input, 16, (uint8_t *)output, 10) != HAL_OK) {
// error found
return ST_ERR_AES_BUSY;
}
return 0;
}
int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] )
{
if(HAL_CRYP_AESECB_Decrypt(&ctx->hcryp_aes, (uint8_t *)input, 16, (uint8_t *)output, 10) != HAL_OK) {
// error found
return ST_ERR_AES_BUSY;
}
return 0;
}
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] )
{
if (HAL_CRYP_AESECB_Encrypt(&ctx->hcryp_aes, (uint8_t *)input, 16, (uint8_t *)output, 10) !=0) {
// error found to be returned
}
mbedtls_internal_aes_encrypt( ctx, input, output );
}
void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] )
{
if(HAL_CRYP_AESECB_Decrypt(&ctx->hcryp_aes, (uint8_t *)input, 16, (uint8_t *)output, 10)) {
// error found to be returned
}
mbedtls_internal_aes_decrypt( ctx, input, output );
}
#endif /* MBEDTLS_DEPRECATED_REMOVED */
#endif /*MBEDTLS_AES_ALT*/

View File

@ -1,7 +1,7 @@
/*
* aes_alt.h AES block cipher
*******************************************************************************
* Copyright (c) 2016, STMicroelectronics
* Copyright (c) 2017, STMicroelectronics
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -30,6 +30,9 @@
#ifdef __cplusplus
extern "C" {
#endif
#define ST_AES_TIMEOUT ((uint32_t) 0xFF) /* 255 ms timeout for the crypto processor */
#define ST_ERR_AES_BUSY (-0x0023) /* Crypto processor is busy, timeout occured */
/**
* \brief AES context structure
*
@ -236,10 +239,12 @@ int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
* \param ctx AES context
* \param input Plaintext block
* \param output Output (ciphertext) block
*
* \return 0 if successful
*/
void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] );
int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] );
/**
* \brief Internal AES block decryption function
@ -249,10 +254,49 @@ void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
* \param ctx AES context
* \param input Ciphertext block
* \param output Output (plaintext) block
*
* \return 0 if successful
*/
void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] );
int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] );
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
#if defined(MBEDTLS_DEPRECATED_WARNING)
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
#else
#define MBEDTLS_DEPRECATED
#endif
/**
* \brief Deprecated internal AES block encryption function
* without return value.
*
* \deprecated Superseded by mbedtls_aes_encrypt_ext() in 2.5.0
*
* \param ctx AES context
* \param input Plaintext block
* \param output Output (ciphertext) block
*/
MBEDTLS_DEPRECATED void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] );
/**
* \brief Deprecated internal AES block decryption function
* without return value.
*
* \deprecated Superseded by mbedtls_aes_decrypt_ext() in 2.5.0
*
* \param ctx AES context
* \param input Ciphertext block
* \param output Output (plaintext) block
*/
MBEDTLS_DEPRECATED void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
#ifdef __cplusplus
}

View File

@ -100,10 +100,21 @@ const void *coap_security_handler_keyblock(const coap_security_t *sec);
NS_DUMMY_DEFINITIONS_OK
/* Dummy definitions, including needed error codes */
#ifndef MBEDTLS_ERR_SSL_TIMEOUT
#define MBEDTLS_ERR_SSL_TIMEOUT (-1)
#endif
#ifndef MBEDTLS_ERR_SSL_WANT_READ
#define MBEDTLS_ERR_SSL_WANT_READ (-2)
#endif
#ifndef MBEDTLS_ERR_SSL_WANT_WRITE
#define MBEDTLS_ERR_SSL_WANT_WRITE (-3)
#endif
#ifndef MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE
#define MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE (-4)
#endif
#define coap_security_create(socket_id, timer_id, handle, \
mode, send_cb, receive_cb, start_timer_cb, timer_status_cb) ((coap_security_t *) 0)

View File

@ -75,9 +75,9 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address);
*/
int32_t flash_read(flash_t *obj, uint32_t address, uint8_t *data, uint32_t size);
/** Program one page starting at defined address
/** Program pages starting at defined address
*
* The page should be at page boundary, should not cross multiple sectors.
* The pages should not cross multiple sectors.
* This function does not do any check for address alignments or if size is aligned to a page size.
* @param obj The flash object
* @param address The sector starting address
@ -97,6 +97,7 @@ uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address);
/** Get page size
*
* The page size defines the writable page size
* @param obj The flash object
* @return The size of a page
*/

4
mbed.h
View File

@ -16,13 +16,13 @@
#ifndef MBED_H
#define MBED_H
#define MBED_LIBRARY_VERSION 151
#define MBED_LIBRARY_VERSION 152
#if MBED_CONF_RTOS_PRESENT
// RTOS present, this is valid only for mbed OS 5
#define MBED_MAJOR_VERSION 5
#define MBED_MINOR_VERSION 6
#define MBED_PATCH_VERSION 0
#define MBED_PATCH_VERSION 1
#else
// mbed 2

View File

@ -207,26 +207,46 @@ extern "C" void * __wrap__memalign_r(struct _reent * r, size_t alignment, size_t
/******************************************************************************/
/* ARMCC memory allocation wrappers */
/* ARMCC / IAR memory allocation wrappers */
/******************************************************************************/
#elif defined(TOOLCHAIN_ARM) // #if defined(TOOLCHAIN_GCC)
#elif defined(TOOLCHAIN_ARM) || defined(__ICCARM__)
#if defined(TOOLCHAIN_ARM)
#define SUPER_MALLOC $Super$$malloc
#define SUB_MALLOC $Sub$$malloc
#define SUPER_REALLOC $Super$$realloc
#define SUB_REALLOC $Sub$$realloc
#define SUPER_CALLOC $Super$$calloc
#define SUB_CALLOC $Sub$$calloc
#define SUPER_FREE $Super$$free
#define SUB_FREE $Sub$$free
#elif defined(__ICCARM__)
#define SUPER_MALLOC $Super$$__iar_dlmalloc
#define SUB_MALLOC $Sub$$__iar_dlmalloc
#define SUPER_REALLOC $Super$$__iar_dlrealloc
#define SUB_REALLOC $Sub$$__iar_dlrealloc
#define SUPER_CALLOC $Super$$__iar_dlcalloc
#define SUB_CALLOC $Sub$$__iar_dlcalloc
#define SUPER_FREE $Super$$__iar_dlfree
#define SUB_FREE $Sub$$__iar_dlfree
#endif
/* Enable hooking of memory function only if tracing is also enabled */
#if defined(MBED_MEM_TRACING_ENABLED) || defined(MBED_HEAP_STATS_ENABLED)
extern "C" {
void *$Super$$malloc(size_t size);
void *$Super$$realloc(void *ptr, size_t size);
void *$Super$$calloc(size_t nmemb, size_t size);
void $Super$$free(void *ptr);
void *SUPER_MALLOC(size_t size);
void *SUPER_REALLOC(void *ptr, size_t size);
void *SUPER_CALLOC(size_t nmemb, size_t size);
void SUPER_FREE(void *ptr);
}
extern "C" void* $Sub$$malloc(size_t size) {
extern "C" void* SUB_MALLOC(size_t size) {
void *ptr = NULL;
#ifdef MBED_HEAP_STATS_ENABLED
malloc_stats_mutex->lock();
alloc_info_t *alloc_info = (alloc_info_t*)$Super$$malloc(size + sizeof(alloc_info_t));
alloc_info_t *alloc_info = (alloc_info_t*)SUPER_MALLOC(size + sizeof(alloc_info_t));
if (alloc_info != NULL) {
alloc_info->size = size;
ptr = (void*)(alloc_info + 1);
@ -241,7 +261,7 @@ extern "C" void* $Sub$$malloc(size_t size) {
}
malloc_stats_mutex->unlock();
#else // #ifdef MBED_HEAP_STATS_ENABLED
ptr = $Super$$malloc(size);
ptr = SUPER_MALLOC(size);
#endif // #ifdef MBED_HEAP_STATS_ENABLED
#ifdef MBED_MEM_TRACING_ENABLED
mem_trace_mutex->lock();
@ -251,7 +271,7 @@ extern "C" void* $Sub$$malloc(size_t size) {
return ptr;
}
extern "C" void* $Sub$$realloc(void *ptr, size_t size) {
extern "C" void* SUB_REALLOC(void *ptr, size_t size) {
void *new_ptr = NULL;
#ifdef MBED_HEAP_STATS_ENABLED
// Note - no lock needed since malloc and free are thread safe
@ -276,7 +296,7 @@ extern "C" void* $Sub$$realloc(void *ptr, size_t size) {
free(ptr);
}
#else // #ifdef MBED_HEAP_STATS_ENABLED
new_ptr = $Super$$realloc(ptr, size);
new_ptr = SUPER_REALLOC(ptr, size);
#endif // #ifdef MBED_HEAP_STATS_ENABLED
#ifdef MBED_MEM_TRACING_ENABLED
mem_trace_mutex->lock();
@ -286,7 +306,7 @@ extern "C" void* $Sub$$realloc(void *ptr, size_t size) {
return new_ptr;
}
extern "C" void *$Sub$$calloc(size_t nmemb, size_t size) {
extern "C" void *SUB_CALLOC(size_t nmemb, size_t size) {
void *ptr = NULL;
#ifdef MBED_HEAP_STATS_ENABLED
// Note - no lock needed since malloc is thread safe
@ -295,7 +315,7 @@ extern "C" void *$Sub$$calloc(size_t nmemb, size_t size) {
memset(ptr, 0, nmemb * size);
}
#else // #ifdef MBED_HEAP_STATS_ENABLED
ptr = $Super$$calloc(nmemb, size);
ptr = SUPER_CALLOC(nmemb, size);
#endif // #ifdef MBED_HEAP_STATS_ENABLED
#ifdef MBED_MEM_TRACING_ENABLED
mem_trace_mutex->lock();
@ -305,7 +325,7 @@ extern "C" void *$Sub$$calloc(size_t nmemb, size_t size) {
return ptr;
}
extern "C" void $Sub$$free(void *ptr) {
extern "C" void SUB_FREE(void *ptr) {
#ifdef MBED_HEAP_STATS_ENABLED
malloc_stats_mutex->lock();
alloc_info_t *alloc_info = NULL;
@ -314,10 +334,10 @@ extern "C" void $Sub$$free(void *ptr) {
heap_stats.current_size -= alloc_info->size;
heap_stats.alloc_cnt -= 1;
}
$Super$$free((void*)alloc_info);
SUPER_FREE((void*)alloc_info);
malloc_stats_mutex->unlock();
#else // #ifdef MBED_HEAP_STATS_ENABLED
$Super$$free(ptr);
SUPER_FREE(ptr);
#endif // #ifdef MBED_HEAP_STATS_ENABLED
#ifdef MBED_MEM_TRACING_ENABLED
mem_trace_mutex->lock();
@ -332,15 +352,14 @@ extern "C" void $Sub$$free(void *ptr) {
/* Allocation wrappers for other toolchains are not supported yet */
/******************************************************************************/
#else // #if defined(TOOLCHAIN_GCC)
#else
#ifdef MBED_MEM_TRACING_ENABLED
#warning Memory tracing is not supported with the current toolchain.
#error Memory tracing is not supported with the current toolchain.
#endif
#ifdef MBED_HEAP_STATS_ENABLED
#warning Heap statistics are not supported with the current toolchain.
#error Heap statistics are not supported with the current toolchain.
#endif
#endif // #if defined(TOOLCHAIN_GCC)

View File

@ -19,8 +19,17 @@
#include "rtx_evr.h"
#include "mbed_rtx.h"
#include "mbed_error.h"
#include "RTX_Config.h"
#ifdef RTE_Compiler_EventRecorder
#include "EventRecorder.h" // Keil::Compiler:Event Recorder
// Used from rtx_evr.c
#define EvtRtxThreadExit EventID(EventLevelAPI, 0xF2U, 0x19U)
#define EvtRtxThreadTerminate EventID(EventLevelAPI, 0xF2U, 0x1AU)
#endif
extern void rtos_idle_loop(void);
extern void thread_terminate_hook(osThreadId_t id);
__NO_RETURN void osRtxIdleThread (void *argument)
{
@ -136,3 +145,21 @@ void EvrRtxMessageQueueError (osMessageQueueId_t mq_id, int32_t status)
}
#endif
// RTX hook which gets called when a thread terminates, using the event function to call hook
void EvrRtxThreadExit (void)
{
osThreadId_t thread_id = osThreadGetId();
thread_terminate_hook(thread_id);
#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_EXIT_DISABLE) && defined(RTE_Compiler_EventRecorder))
EventRecord2(EvtRtxThreadExit, 0U, 0U);
#endif
}
void EvrRtxThreadTerminate (osThreadId_t thread_id)
{
thread_terminate_hook(thread_id);
#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_TERMINATE_DISABLE) && defined(RTE_Compiler_EventRecorder))
EventRecord2(EvtRtxThreadTerminate, (uint32_t)thread_id, 0U);
#endif
}

View File

@ -51,14 +51,22 @@
#define __ram_vector_table_size__ 0x00000000
#endif
#define m_interrupts_start 0x00000000
#if !defined(MBED_APP_START)
#define MBED_APP_START 0
#endif
#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x80000
#endif
#define m_interrupts_start MBED_APP_START
#define m_interrupts_size 0x00000400
#define m_flash_config_start 0x00000400
#define m_flash_config_start MBED_APP_START + 0x400
#define m_flash_config_size 0x00000010
#define m_text_start 0x00000410
#define m_text_size 0x0007FBF0
#define m_text_start MBED_APP_START + 0x410
#define m_text_size MBED_APP_SIZE - 0x410
#define m_interrupts_ram_start 0x1FFF8000
#define m_interrupts_ram_size __ram_vector_table_size__

View File

@ -58,6 +58,14 @@ __stack_size__ = 0x400;
* heap and the page heap in uVisor applications. */
__heap_size__ = 0x4000;
#if !defined(MBED_APP_START)
#define MBED_APP_START 0
#endif
#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x80000
#endif
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
@ -65,9 +73,9 @@ M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
/* Specify the memory areas */
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0
m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x400
m_flash_config (RX) : ORIGIN = MBED_APP_START + 0x400, LENGTH = 0x10
m_text (RX) : ORIGIN = MBED_APP_START + 0x410, LENGTH = MBED_APP_SIZE - 0x410
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}

View File

@ -48,17 +48,25 @@ define symbol __ram_vector_table__ = 1;
define symbol __stack_size__=0x2000;
define symbol __heap_size__=0x4000;
if (!isdefinedsymbol(MBED_APP_START)) {
define symbol MBED_APP_START = 0;
}
if (!isdefinedsymbol(MBED_APP_SIZE)) {
define symbol MBED_APP_SIZE = 0x80000;
}
define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000400 : 0;
define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000003FF : 0;
define symbol m_interrupts_start = 0x00000000;
define symbol m_interrupts_end = 0x000003FF;
define symbol m_interrupts_start = MBED_APP_START;
define symbol m_interrupts_end = MBED_APP_START + 0x3FF;
define symbol m_flash_config_start = 0x00000400;
define symbol m_flash_config_end = 0x0000040F;
define symbol m_flash_config_start = MBED_APP_START + 0x400;
define symbol m_flash_config_end = MBED_APP_START + 0x40F;
define symbol m_text_start = 0x00000410;
define symbol m_text_end = 0x0007FFFF;
define symbol m_text_start = MBED_APP_START + 0x410;
define symbol m_text_end = MBED_APP_START + MBED_APP_SIZE - 1;
define symbol m_interrupts_ram_start = 0x1FFF8000;
define symbol m_interrupts_ram_end = 0x1FFF8000 + __ram_vector_table_offset__;

View File

@ -9,7 +9,7 @@ define symbol __ICFEDIT_region_ROM_end__ = 0x0007FFFF;
define symbol __ICFEDIT_region_NVIC_start__ = 0x10000000;
define symbol __ICFEDIT_region_NVIC_end__ = 0x100000C7;
define symbol __ICFEDIT_region_RAM_start__ = 0x100000C8;
define symbol __ICFEDIT_region_RAM_end__ = 0x10007FDF;
define symbol __ICFEDIT_region_RAM_end__ = 0x10007FE0;
/*-Sizes-*/
/*Heap 1/4 of ram and stack 1/8*/

View File

@ -13,55 +13,169 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if DEVICE_FLASH
#include "mbed_critical.h"
#include "flash_api.h"
#include "platform/mbed_critical.h"
#include "mbed_assert.h"
#include "cmsis.h"
#include <stdlib.h>
#include <string.h>
// This file is automatically generated
#define MEMMAP (*((volatile unsigned long *) 0x400FC040))
#if DEVICE_FLASH
#define PLL0CON (*((volatile unsigned long *) 0x400FC080))
#define PLL0CFG (*((volatile unsigned long *) 0x400FC084))
#define PLL0STAT (*((volatile unsigned long *) 0x400FC088))
#define PLL0FEED (*((volatile unsigned long *) 0x400FC08C))
#define CCLKSEL (*((volatile unsigned long *) 0x400FC104))
#define CLKSRCSEL (*((volatile unsigned long *) 0x400FC10C))
#include "flash_data.h"
#define STACK_SIZE 64 // Stack Size
// This is a flash algo binary blob. It is PIC (position independent code) that should be stored in RAM
static uint32_t FLASH_ALGO[] = {
0x28100b00, 0x210ed302, 0x00d0eb01, 0xf44f4770, 0xfbb1707a, 0x4933f0f0, 0x60084449, 0x20014932,
0x20006408, 0x20004770, 0xe92d4770, 0xf7ff41f0, 0x4d2effe7, 0x444d4604, 0xe9c52032, 0xf1050400,
0x4e2b0114, 0x4628460f, 0x47b060ac, 0xb9686968, 0xe9c52034, 0x48230400, 0x444860ac, 0x68004639,
0x462860e8, 0x696847b0, 0xd0002800, 0xe8bd2001, 0xe92d81f0, 0x461441f0, 0xd10e0006, 0x0100e9d4,
0xe9d44408, 0x44111202, 0x69214408, 0x69614408, 0x69a14408, 0x42404408, 0x463061e0, 0xffb0f7ff,
0x21324d12, 0x4f12444d, 0x1000e9c5, 0x0114f105, 0x468860a8, 0x47b84628, 0xb9806968, 0xe9c52033,
0xf44f0600, 0xe9c56080, 0x48064002, 0x44484641, 0x61286800, 0x47b84628, 0x28006968, 0x2001d0c7,
0x0000e7c5, 0x00000004, 0x400fc000, 0x00000008, 0x1fff1ff1, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
};
#define SET_VALID_CODE 1 // Set Valid User Code Signature
/* IAP Call */
typedef void (*IAP_Entry) (unsigned long *cmd, unsigned long *stat);
#define IAP_Call ((IAP_Entry) 0x1FFF1FF1)
static const flash_algo_t flash_algo_config = {
.init = 0xf,
.uninit = 0x27,
.erase_sector = 0x2b,
.program_page = 0x73,
.static_base = 0xf4,
.algo_blob = FLASH_ALGO
};
typedef struct flash_s flash_t;
unsigned long CCLK; // CCLK in kHz
static const sector_info_t sectors_info[] = {
{0x0, 0x1000},
{0x10000, 0x8000},
};
struct sIAP { // IAP Structure
unsigned long cmd;// Command
unsigned long par[4];// Parameters
unsigned long stat;// Status
unsigned long res[2];// Result
}IAP;
static const flash_target_config_t flash_target_config = {
.page_size = 0x400,
.flash_start = 0x0,
.flash_size = 0x80000,
.sectors = sectors_info,
.sector_info_count = sizeof(sectors_info) / sizeof(sector_info_t)
};
/*
* Get Sector Number
* Parameter: address: Sector Address
* Return Value: Sector Number
*/
void flash_set_target_config(flash_t *obj)
unsigned long GetSecNum (unsigned long address)
{
obj->flash_algo = &flash_algo_config;
obj->target_config = &flash_target_config;
unsigned long n;
n = address >> 12; // 4kB Sector
if (n >= 0x10) {
n = 0x0E + (n >> 3); // 32kB Sector
}
return (n); // Sector Number
}
int32_t flash_init(flash_t *obj)
{
CCLK = SystemCoreClock / 1000; // CCLK value is in kHz, clk in Hz
MEMMAP = 0x01;// User Flash Mode
return (0);
}
int32_t flash_free(flash_t *obj)
{
return 0;
}
int32_t flash_erase_sector(flash_t *obj, uint32_t address)
{
unsigned long n;
n = GetSecNum(address); // Get Sector Number
core_util_critical_section_enter();
IAP.cmd = 50;// Prepare Sector for Erase
IAP.par[0] = n;// Start Sector
IAP.par[1] = n;// End Sector
IAP_Call (&IAP.cmd, &IAP.stat);// Call IAP Command
if (IAP.stat) {
return (1); // Command Failed
}
IAP.cmd = 52; // Erase Sector
IAP.par[0] = n;// Start Sector
IAP.par[1] = n;// End Sector
IAP.par[2] = CCLK;// CCLK in kHz
IAP_Call (&IAP.cmd, &IAP.stat);// Call IAP Command
core_util_critical_section_exit();
if (IAP.stat) {
return (1); // Command Failed
}
return (0); // Finished without Errors
}
int32_t flash_program_page(flash_t *obj, uint32_t address,
const uint8_t *data, uint32_t size)
{
unsigned long n;
// always malloc outside critical section
uint8_t *alignedData = malloc(size);
n = GetSecNum(address); // Get Sector Number
core_util_critical_section_enter();
IAP.cmd = 50;// Prepare Sector for Write
IAP.par[0] = n;// Start Sector
IAP.par[1] = n;// End Sector
IAP_Call (&IAP.cmd, &IAP.stat);// Call IAP Command
if (IAP.stat) {
return (1); // Command Failed
}
IAP.cmd = 51; // Copy RAM to Flash
IAP.par[0] = address;// Destination Flash Address
if ((unsigned long)data%4==0) { // Word boundary
IAP.par[1] = (unsigned long)data;// Source RAM Address
} else {
memcpy(alignedData,data,size);
IAP.par[1] = (unsigned long)alignedData; // Source RAM Address
}
IAP.par[2] = 1024; // Fixed Page Size
IAP.par[3] = CCLK;// CCLK in kHz
IAP_Call (&IAP.cmd, &IAP.stat);// Call IAP Command
core_util_critical_section_exit();
if(alignedData !=0) { // We allocated our own memory
free(alignedData);
}
if (IAP.stat) {
return (1); // Command Failed
}
return (0); // Finished without Errors
}
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
{
if (address < flash_get_start_address(obj) || address >= flash_get_start_address(obj) +flash_get_size(obj)) {
return MBED_FLASH_INVALID_SIZE;
}
if(GetSecNum(address)>=0x10) {
return 0x8000;
} else {
return 0x1000;
}
}
uint32_t flash_get_page_size(const flash_t *obj)
{
return 1024;
}
uint32_t flash_get_start_address(const flash_t *obj)
{
return LPC_FLASH_BASE;
}
uint32_t flash_get_size(const flash_t *obj)
{
return 0x80000;
}
#endif

View File

@ -71,6 +71,10 @@ struct spi_s {
LPC_SSP_TypeDef *spi;
};
struct flash_s {
/* nothing to be stored for now */
uint32_t dummy;
};
#ifdef __cplusplus
}
#endif

View File

@ -19,18 +19,9 @@ LR_IRAM 0x10007000 (0x70000 - 0x7000) {
ER_IRAM +0 FIXED {
*rtl8195a_crypto.o (+RO)
* (i.mbedtls*)
*(i.mbedtls*)
*libc.a (+RO)
*rtx_*.o (+RO)
*Ticker.o (+RO)
*Timeout.o (+RO)
*rtx_timer.o (+RO)
*TimerEvent.o (+RO)
*mbed_ticker_api.o (+RO)
*mbed_critical.o (+RO)
*us_ticker.o (+RO)
*rtx_*.o (+RO)
*lib_peripheral_mbed_arm.ar (+RO)
}

View File

@ -70,15 +70,7 @@ SECTIONS
*rtl8195a_crypto.o (.text* .rodata*)
*mbedtls*.o (.text* .rodata*)
*libc.a: (.text* .rodata*)
*Ticker.o (.text*)
*Timeout.o (.text*)
*TimerEvent.o (.text*)
*mbed_ticker_api.o (.text*)
*mbed_critical.o (.text*)
*us_ticker.o (.text*)
*lib_peripheral_mbed_gcc.a: (.text*)
} > SRAM1
.text.sram2 :

View File

@ -213,13 +213,6 @@ define block MBEDTLS_TEXT with alignment = 8, fixed order{
define block .sram1.text with fixed order {
block MBEDTLS_TEXT,
section .text* object Ticker.o,
section .text* object Timeout.o,
section .text* object TimerEvent.o,
section .text* object mbed_ticker_api.o,
section .text* object mbed_critical.o,
section .text* object us_ticker.o,
section .text* object lib_peripheral_mbed_iar.a,
};

View File

@ -20,10 +20,22 @@
#include "PeripheralNames.h"
#define TICK_READ_FROM_CPU 0 // 1: read tick from CPU, 0: read tick from G-Timer
#define SYS_TIM_ID 1 // the G-Timer ID for System
#define APP_TIM_ID 6 // the G-Timer ID for Application
#define SYS_TIM_ID 1 // the G-Timer ID for System
#define APP_TIM_ID 6 // the G-Timer ID for Application
#define TICK_TO_US(x) (uint64_t)(((x)/2) * 61 + ((x)%2) * TIMER_TICK_US)
/*
* For RTL8195AM, clock source is 32k
*
* us per tick: 30.5
* tick per ms: 32.7
* tick per us: 0.032
* tick per sec: 32768
*
* Define the following macros to convert between TICK and US.
*/
#define MS_TO_TICK(x) (uint64_t)(((x)*327) / 10)
#define US_TO_TICK(x) (uint64_t)(((x)*32) / 1000)
#define TICK_TO_US(x) (uint64_t)(((x)/2) * 61 + ((x)%2) * TIMER_TICK_US)
static int us_ticker_inited = 0;
static TIMER_ADAPTER TimerAdapter;
@ -34,23 +46,22 @@ extern HAL_TIMER_OP_EXT HalTimerOpExt;
VOID _us_ticker_irq_handler(void *Data)
{
us_ticker_irq_handler();
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId);
}
void us_ticker_init(void)
{
if (us_ticker_inited){
if (us_ticker_inited) {
return;
}
us_ticker_inited = 1;
// Reload and restart sys-timer
HalTimerOp.HalTimerDis(SYS_TIM_ID);
HalTimerOpExt.HalTimerReLoad(SYS_TIM_ID, 0xFFFFFFFFUL);
HalTimerOp.HalTimerEn(SYS_TIM_ID);
// Initial a G-Timer
// Initial a app-timer
TimerAdapter.IrqDis = 0; // Enable Irq @ initial
TimerAdapter.IrqHandle.IrqFun = (IRQ_FUN) _us_ticker_irq_handler;
TimerAdapter.IrqHandle.IrqNum = TIMER2_7_IRQ;
@ -97,7 +108,7 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
return;
}
TimerAdapter.TimerLoadValueUs = time_cnt / TIMER_TICK_US;
TimerAdapter.TimerLoadValueUs = MAX(MS_TO_TICK(time_cnt/1000) + US_TO_TICK(time_cnt%1000), 1);
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, TimerAdapter.TimerLoadValueUs);
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId);
}

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -128,6 +128,14 @@ struct dac_s {
};
#endif
#if DEVICE_CAN
struct can_s {
CAN_HandleTypeDef CanHandle;
int index;
int hz;
};
#endif
#ifdef __cplusplus
}
#endif

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -116,6 +116,14 @@ struct analogin_s {
uint8_t channel;
};
#if DEVICE_CAN
struct can_s {
CAN_HandleTypeDef CanHandle;
int index;
int hz;
};
#endif
#include "gpio_object.h"
#ifdef __cplusplus

View File

@ -136,10 +136,13 @@ struct pwmout_s {
uint8_t inverted;
};
#ifdef DEVICE_CAN
struct can_s {
CANName can;
CAN_HandleTypeDef CanHandle;
int index;
int hz;
};
#endif
#define GPIO_IP_WITHOUT_BRR
#include "gpio_object.h"

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -54,13 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
#if defined (DEVICE_CAN)
struct can_s {
CANName can;
int index;
};
#endif
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -124,6 +124,14 @@ struct analogin_s {
uint8_t channel;
};
#if DEVICE_CAN
struct can_s {
CAN_HandleTypeDef CanHandle;
int index;
int hz;
};
#endif
#include "gpio_object.h"
#ifdef __cplusplus

View File

@ -40,11 +40,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -40,11 +40,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -59,11 +59,6 @@ struct trng_s {
};
#include "common_objects.h"
struct can_s {
CANName can;
int index;
};
#include "gpio_object.h"
#ifdef __cplusplus

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
#include "common_objects.h"
#ifdef __cplusplus

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -133,6 +133,14 @@ struct dac_s {
};
#endif
#if DEVICE_CAN
struct can_s {
CAN_HandleTypeDef CanHandle;
int index;
int hz;
};
#endif
#ifdef __cplusplus
}
#endif

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -132,6 +132,14 @@ struct flash_s {
uint32_t dummy;
};
#if DEVICE_CAN
struct can_s {
CAN_HandleTypeDef CanHandle;
int index;
int hz;
};
#endif
#ifdef __cplusplus
}
#endif

View File

@ -170,6 +170,22 @@ typedef enum {
SE_IO = PB_10,
SE_CLK = PB_11,
#ifdef TARGET_FF1705_L151CC
// Arduino Headers
A0 = PA_0,
A1 = PB_0,
D0 = PA_10,
D1 = PA_9,
D2 = PA_11,
D3 = PA_12,
D10 = PB_12,
D11 = PB_15,
D12 = PB_14,
D13 = PB_13,
D14 = I2C_SDA,
D15 = I2C_SCL,
#endif
// Not connected
NC = (int)0xFFFFFFFF
} PinName;

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -54,11 +54,6 @@ struct port_s {
__IO uint32_t *reg_out;
};
struct can_s {
CANName can;
int index;
};
struct trng_s {
RNG_HandleTypeDef handle;
};

View File

@ -135,6 +135,14 @@ struct dac_s {
}
#endif
#if DEVICE_CAN
struct can_s {
CAN_HandleTypeDef CanHandle;
int index;
int hz;
};
#endif
/* STM32L4 HAL doesn't provide this API called in rtc_api.c */
#define __HAL_RCC_RTC_CLKPRESCALER(__RTCCLKSource__)

View File

@ -25,10 +25,21 @@
#include <math.h>
#include <string.h>
static CAN_HandleTypeDef CanHandle;
static uint32_t can_irq_ids[CAN_NUM] = {0};
static can_irq_handler irq_handler;
static void can_registers_init(can_t *obj)
{
if (HAL_CAN_Init(&obj->CanHandle) != HAL_OK) {
error("Cannot initialize CAN");
}
// Set initial CAN frequency to specified frequency
if (can_frequency(obj, obj->hz) != 1) {
error("Can frequency could not be set\n");
}
}
void can_init(can_t *obj, PinName rd, PinName td)
{
can_init_freq(obj, rd, td, 100000);
@ -38,16 +49,16 @@ void can_init_freq (can_t *obj, PinName rd, PinName td, int hz)
{
CANName can_rd = (CANName)pinmap_peripheral(rd, PinMap_CAN_RD);
CANName can_td = (CANName)pinmap_peripheral(td, PinMap_CAN_TD);
CANName can = (CANName)pinmap_merge(can_rd, can_td);
obj->can = (CANName)pinmap_merge(can_rd, can_td);
MBED_ASSERT((int)obj->can != NC);
MBED_ASSERT((int)can != NC);
if (obj->can == CAN_1) {
if (can == CAN_1) {
__HAL_RCC_CAN1_CLK_ENABLE();
obj->index = 0;
}
#if defined(CAN2_BASE) && (CAN_NUM == 2)
else if (obj->can == CAN_2) {
else if (can == CAN_2) {
__HAL_RCC_CAN1_CLK_ENABLE(); // needed to set filters
__HAL_RCC_CAN2_CLK_ENABLE();
obj->index = 1;
@ -67,33 +78,30 @@ void can_init_freq (can_t *obj, PinName rd, PinName td, int hz)
pin_mode(td, PullUp);
}
CanHandle.Instance = (CAN_TypeDef *)(obj->can);
/* Use default values for rist init */
obj->CanHandle.Instance = (CAN_TypeDef *)can;
obj->CanHandle.Init.TTCM = DISABLE;
obj->CanHandle.Init.ABOM = DISABLE;
obj->CanHandle.Init.AWUM = DISABLE;
obj->CanHandle.Init.NART = DISABLE;
obj->CanHandle.Init.RFLM = DISABLE;
obj->CanHandle.Init.TXFP = DISABLE;
obj->CanHandle.Init.Mode = CAN_MODE_NORMAL;
obj->CanHandle.Init.SJW = CAN_SJW_1TQ;
obj->CanHandle.Init.BS1 = CAN_BS1_6TQ;
obj->CanHandle.Init.BS2 = CAN_BS2_8TQ;
obj->CanHandle.Init.Prescaler = 2;
CanHandle.Init.TTCM = DISABLE;
CanHandle.Init.ABOM = DISABLE;
CanHandle.Init.AWUM = DISABLE;
CanHandle.Init.NART = DISABLE;
CanHandle.Init.RFLM = DISABLE;
CanHandle.Init.TXFP = DISABLE;
CanHandle.Init.Mode = CAN_MODE_NORMAL;
CanHandle.Init.SJW = CAN_SJW_1TQ;
CanHandle.Init.BS1 = CAN_BS1_6TQ;
CanHandle.Init.BS2 = CAN_BS2_8TQ;
CanHandle.Init.Prescaler = 2;
/* Store frequency to be restored in case of reset */
obj->hz = hz;
if (HAL_CAN_Init(&CanHandle) != HAL_OK) {
error("Cannot initialize CAN");
}
can_registers_init(obj);
// Set initial CAN frequency to specified frequency
if (can_frequency(obj, hz) != 1) {
error("Can frequency could not be set\n");
}
uint32_t filter_number = (obj->can == CAN_1) ? 0 : 14;
uint32_t filter_number = (can == CAN_1) ? 0 : 14;
can_filter(obj, 0, 0, CANStandard, filter_number);
}
void can_irq_init(can_t *obj, can_irq_handler handler, uint32_t id)
{
irq_handler = handler;
@ -102,7 +110,7 @@ void can_irq_init(can_t *obj, can_irq_handler handler, uint32_t id)
void can_irq_free(can_t *obj)
{
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
CAN_TypeDef *can = obj->CanHandle.Instance;
can->IER &= ~(CAN_IT_FMP0 | CAN_IT_FMP1 | CAN_IT_TME | \
CAN_IT_ERR | CAN_IT_EPV | CAN_IT_BOF);
@ -111,14 +119,15 @@ void can_irq_free(can_t *obj)
void can_free(can_t *obj)
{
CANName can = (CANName) obj->CanHandle.Instance;
// Reset CAN and disable clock
if (obj->can == CAN_1) {
if (can == CAN_1) {
__HAL_RCC_CAN1_FORCE_RESET();
__HAL_RCC_CAN1_RELEASE_RESET();
__HAL_RCC_CAN1_CLK_DISABLE();
}
#if defined(CAN2_BASE) && (CAN_NUM == 2)
if (obj->can == CAN_2) {
if (can == CAN_2) {
__HAL_RCC_CAN2_FORCE_RESET();
__HAL_RCC_CAN2_RELEASE_RESET();
__HAL_RCC_CAN2_CLK_DISABLE();
@ -196,7 +205,7 @@ int can_frequency(can_t *obj, int f)
{
int pclk = HAL_RCC_GetPCLK1Freq();
int btr = can_speed(pclk, (unsigned int)f, 1);
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
CAN_TypeDef *can = obj->CanHandle.Instance;
uint32_t tickstart = 0;
int status = 1;
@ -211,7 +220,11 @@ int can_frequency(can_t *obj, int f)
}
}
if (status != 0) {
can->BTR = btr;
/* Do not erase all BTR registers (e.g. silent mode), only the
* ones calculated in can_speed */
can->BTR &= ~(CAN_BTR_TS2 | CAN_BTR_TS1 | CAN_BTR_SJW | CAN_BTR_BRP);
can->BTR |= btr;
can->MCR &= ~(uint32_t)CAN_MCR_INRQ;
/* Get tick */
tickstart = HAL_GetTick();
@ -236,7 +249,7 @@ int can_frequency(can_t *obj, int f)
int can_write(can_t *obj, CAN_Message msg, int cc)
{
uint32_t transmitmailbox = CAN_TXSTATUS_NOMAILBOX;
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
CAN_TypeDef *can = obj->CanHandle.Instance;
/* Select one empty transmit mailbox */
if ((can->TSR & CAN_TSR_TME0) == CAN_TSR_TME0) {
@ -279,7 +292,7 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
{
//handle is the FIFO number
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
CAN_TypeDef *can = obj->CanHandle.Instance;
// check FPM0 which holds the pending message count in FIFO 0
// if no message is pending, return 0
@ -324,46 +337,61 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
void can_reset(can_t *obj)
{
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
CAN_TypeDef *can = obj->CanHandle.Instance;
/* Reset IP and delete errors */
can->MCR |= CAN_MCR_RESET;
can->ESR = 0x0;
/* restore registers state as saved in obj context */
can_registers_init(obj);
}
unsigned char can_rderror(can_t *obj)
{
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
CAN_TypeDef *can = obj->CanHandle.Instance;
return (can->ESR >> 24) & 0xFF;
}
unsigned char can_tderror(can_t *obj)
{
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
CAN_TypeDef *can = obj->CanHandle.Instance;
return (can->ESR >> 16) & 0xFF;
}
void can_monitor(can_t *obj, int silent)
{
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
can->MCR |= CAN_MCR_INRQ ;
while ((can->MSR & CAN_MSR_INAK) != CAN_MSR_INAK) {
}
if (silent) {
can->BTR |= ((uint32_t)1 << 31);
CanMode mode = MODE_NORMAL;
/* Update current state w/ or w/o silent */
if(silent) {
switch (obj->CanHandle.Init.Mode) {
case CAN_MODE_LOOPBACK:
case CAN_MODE_SILENT_LOOPBACK:
mode = MODE_TEST_SILENT;
break;
default:
mode = MODE_SILENT;
break;
}
} else {
can->BTR &= ~((uint32_t)1 << 31);
switch (obj->CanHandle.Init.Mode) {
case CAN_MODE_LOOPBACK:
case CAN_MODE_SILENT_LOOPBACK:
mode = MODE_TEST_LOCAL;
break;
default:
mode = MODE_NORMAL;
break;
}
}
can->MCR &= ~(uint32_t)CAN_MCR_INRQ;
while ((can->MSR & CAN_MSR_INAK) == CAN_MSR_INAK) {
}
can_mode(obj, mode);
}
int can_mode(can_t *obj, CanMode mode)
{
int success = 0;
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
CAN_TypeDef *can = obj->CanHandle.Instance;
can->MCR |= CAN_MCR_INRQ ;
while ((can->MSR & CAN_MSR_INAK) != CAN_MSR_INAK) {
@ -371,21 +399,25 @@ int can_mode(can_t *obj, CanMode mode)
switch (mode) {
case MODE_NORMAL:
obj->CanHandle.Init.Mode = CAN_MODE_NORMAL;
can->BTR &= ~(CAN_BTR_SILM | CAN_BTR_LBKM);
success = 1;
break;
case MODE_SILENT:
obj->CanHandle.Init.Mode = CAN_MODE_SILENT;
can->BTR |= CAN_BTR_SILM;
can->BTR &= ~CAN_BTR_LBKM;
success = 1;
break;
case MODE_TEST_GLOBAL:
case MODE_TEST_LOCAL:
obj->CanHandle.Init.Mode = CAN_MODE_LOOPBACK;
can->BTR |= CAN_BTR_LBKM;
can->BTR &= ~CAN_BTR_SILM;
success = 1;
break;
case MODE_TEST_SILENT:
obj->CanHandle.Init.Mode = CAN_MODE_SILENT_LOOPBACK;
can->BTR |= (CAN_BTR_SILM | CAN_BTR_LBKM);
success = 1;
break;
@ -407,7 +439,6 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t
// filter for CANAny format cannot be configured for STM32
if ((format == CANStandard) || (format == CANExtended)) {
CanHandle.Instance = (CAN_TypeDef *)(obj->can);
CAN_FilterConfTypeDef sFilterConfig;
sFilterConfig.FilterNumber = handle;
sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
@ -429,7 +460,7 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t
sFilterConfig.FilterActivation = ENABLE;
sFilterConfig.BankNumber = 14 + handle;
HAL_CAN_ConfigFilter(&CanHandle, &sFilterConfig);
HAL_CAN_ConfigFilter(&obj->CanHandle, &sFilterConfig);
retval = handle;
}
return retval;
@ -438,6 +469,7 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t
static void can_irq(CANName name, int id)
{
uint32_t tmp1 = 0, tmp2 = 0, tmp3 = 0;
CAN_HandleTypeDef CanHandle;
CanHandle.Instance = (CAN_TypeDef *)name;
if (__HAL_CAN_GET_IT_SOURCE(&CanHandle, CAN_IT_TME)) {
@ -535,13 +567,12 @@ void CAN2_SCE_IRQHandler(void)
void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable)
{
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
CAN_TypeDef *can = obj->CanHandle.Instance;
IRQn_Type irq_n = (IRQn_Type)0;
uint32_t vector = 0;
uint32_t ier;
if (obj->can == CAN_1) {
if ((CANName) can == CAN_1) {
switch (type) {
case IRQ_RX:
ier = CAN_IT_FMP0;
@ -573,7 +604,7 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable)
}
}
#if defined(CAN2_BASE) && (CAN_NUM == 2)
else if (obj->can == CAN_2) {
else if ((CANName) can == CAN_2) {
switch (type) {
case IRQ_RX:
ier = CAN_IT_FMP0;

View File

@ -238,7 +238,7 @@
"extra_labels": ["NXP", "LPC176X", "MBED_LPC1768"],
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "GCC_CR", "IAR"],
"detect_code": ["1010"],
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "DEBUG_AWARENESS", "ETHERNET", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOCALFILESYSTEM", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SEMIHOST", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "DEBUG_AWARENESS", "ETHERNET", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOCALFILESYSTEM", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SEMIHOST", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES", "FLASH"],
"release_versions": ["2", "5"],
"features": ["LWIP"],
"device_name": "LPC1768"
@ -250,7 +250,7 @@
"extra_labels": ["NXP", "LPC176X"],
"macros": ["TARGET_LPC1768"],
"inherits": ["LPCTarget"],
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "DEBUG_AWARENESS", "ETHERNET", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "DEBUG_AWARENESS", "ETHERNET", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES", "FLASH"],
"release_versions": ["2", "5"],
"features": ["LWIP"],
"device_name": "LPC1768"
@ -259,7 +259,7 @@
"supported_form_factors": ["ARDUINO"],
"core": "Cortex-M3",
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "GCC_CR", "IAR"],
"extra_labels": ["NXP", "LPC176X", "FLASH_CMSIS_ALGO"],
"extra_labels": ["NXP", "LPC176X"],
"config": {
"modem_is_on_board": {
"help": "Value: Tells the build system that the modem is on-board as oppose to a plug-in shield/module.",
@ -283,7 +283,7 @@
"inherits": ["LPCTarget"],
"core": "Cortex-M3",
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "GCC_CR", "IAR"],
"extra_labels": ["NXP", "LPC176X", "XBED_LPC1768", "FLASH_CMSIS_ALGO"],
"extra_labels": ["NXP", "LPC176X", "XBED_LPC1768"],
"macros": ["TARGET_LPC1768"],
"detect_code": ["1010"],
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "DEBUG_AWARENESS", "ETHERNET", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOCALFILESYSTEM", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SEMIHOST", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES", "FLASH"],
@ -563,9 +563,10 @@
"macros": ["CPU_MKW24D512VHA5", "FSL_RTOS_MBED"],
"inherits": ["Target"],
"detect_code": ["0250"],
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES", "TRNG"],
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES", "TRNG", "FLASH"],
"release_versions": ["2", "5"],
"device_name": "MKW24D512xxx5"
"device_name": "MKW24D512xxx5",
"bootloader_supported": true
},
"KW41Z": {
"supported_form_factors": ["ARDUINO"],
@ -1662,6 +1663,11 @@
"device_name": "STM32L151CC",
"bootloader_supported": true
},
"FF1705_L151CC": {
"supported_form_factors": ["ARDUINO"],
"inherits": ["XDOT_L151CC"],
"detect_code": ["8080"]
},
"MOTE_L152RC": {
"inherits": ["FAMILY_STM32"],
"core": "Cortex-M3",

View File

@ -97,20 +97,26 @@ all: $(PROJECT).bin $(PROJECT)-combined.hex size
all: $(PROJECT).bin $(PROJECT).hex size
{% endif %}
.asm.o:
+@$(call MAKEDIR,$(dir $@))
+@echo "Assemble: $(notdir $<)"
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $<
.s.o:
+@$(call MAKEDIR,$(dir $@))
+@echo "Assemble: $(notdir $<)"
{% if needs_asm_preproc %}
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -E -o $(@:.o=.E.s) $<
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $(@:.o=.E.s)
{% else %}
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $<
{% endif %}
.S.o:
+@$(call MAKEDIR,$(dir $@))
+@echo "Assemble: $(notdir $<)"
{% if needs_asm_preproc %}
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -E -o $(@:.o=.E.s) $<
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $(@:.o=.E.s)
{% else %}
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $<
{% endif %}
.c.o:
+@$(call MAKEDIR,$(dir $@))

View File

@ -35,6 +35,8 @@ class Makefile(Exporter):
MBED_CONFIG_HEADER_SUPPORTED = True
PREPROCESS_ASM = False
POST_BINARY_WHITELIST = set([
"MCU_NRF51Code.binary_hook",
"TEENSY3_1Code.binary_hook",
@ -96,6 +98,7 @@ class Makefile(Exporter):
'link_script_ext': self.toolchain.LINKER_EXT,
'link_script_option': self.LINK_SCRIPT_OPTION,
'user_library_flag': self.USER_LIBRARY_FLAG,
'needs_asm_preproc': self.PREPROCESS_ASM,
}
if hasattr(self.toolchain, "preproc"):
@ -236,6 +239,7 @@ class Armc5(Arm):
"""ARM Compiler 5 (armcc) specific makefile target"""
NAME = 'Make-ARMc5'
TOOLCHAIN = "ARM"
PREPROCESS_ASM = True
class Armc6(Arm):
"""ARM Compiler 6 (armclang) specific generic makefile target"""

View File

@ -1,6 +1,6 @@
"""
mbed SDK
Copyright (c) 2011-2016 ARM Limited
Copyright (c) 2011-2017 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -14,109 +14,508 @@ 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.
"""
from os.path import splitext, basename, join
from random import randint
from tools.utils import mkdir
from tools.export.exporters import Exporter
from tools.export.gnuarmeclipse import GNUARMEclipse
from tools.export.gnuarmeclipse import UID
from tools.build_api import prepare_toolchain
from sys import flags, platform
# Global random number generator instance.
u = UID()
class Sw4STM32(Exporter):
class Sw4STM32(GNUARMEclipse):
"""
Sw4STM32 class
"""
NAME = 'Sw4STM32'
TOOLCHAIN = 'GCC_ARM'
BOARDS = {
'B96B_F446VE': {'name': 'B96B-F446VE', 'mcuId': 'STM32F446VETx'},
'DISCO_F051R8': {'name': 'STM32F0DISCOVERY', 'mcuId': 'STM32F051R8Tx'},
'DISCO_F303VC': {'name': 'STM32F3DISCOVERY', 'mcuId': 'STM32F303VCTx'},
'DISCO_F334C8': {'name': 'STM32F3348DISCOVERY', 'mcuId': 'STM32F334C8Tx'},
'DISCO_F401VC': {'name': 'STM32F401C-DISCO', 'mcuId': 'STM32F401VCTx'},
'DISCO_F407VG': {'name': 'STM32F4DISCOVERY', 'mcuId': 'STM32F407VGTx'},
'DISCO_F413ZH': {'name': 'DISCO_F413', 'mcuId': 'STM32F413ZHTx'},
'DISCO_F429ZI': {'name': 'STM32F429I-DISCO', 'mcuId': 'STM32F429ZITx'},
'DISCO_F469NI': {'name': 'DISCO-F469NI', 'mcuId': 'STM32F469NIHx'},
'DISCO_F746NG': {'name': 'STM32F746G-DISCO', 'mcuId': 'STM32F746NGHx'},
'DISCO_F769NI': {'name': 'DISCO-F769NI', 'mcuId': 'STM32F769NIHx'},
'DISCO_L053C8': {'name': 'STM32L0538DISCOVERY', 'mcuId': 'STM32L053C8Tx'},
'DISCO_L072CZ_LRWAN1': {'name': 'DISCO-L072CZ-LRWAN1', 'mcuId': 'STM32L072CZTx'},
'DISCO_L475VG_IOT01A': {'name': 'STM32L475G-DISCO', 'mcuId': 'STM32L475VGTx'},
'DISCO_L476VG': {'name': 'STM32L476G-DISCO', 'mcuId': 'STM32L476VGTx'},
'NUCLEO_F030R8': {'name': 'NUCLEO-F030R8', 'mcuId': 'STM32F030R8Tx'},
'NUCLEO_F031K6': {'name': 'NUCLEO-F031K6', 'mcuId': 'STM32F031K6Tx'},
'NUCLEO_F042K6': {'name': 'NUCLEO-F042K6', 'mcuId': 'STM32F042K6Tx'},
'NUCLEO_F070RB': {'name': 'NUCLEO-F070RB', 'mcuId': 'STM32F070RBTx'},
'NUCLEO_F072RB': {'name': 'NUCLEO-F072RB', 'mcuId': 'STM32F072RBTx'},
'NUCLEO_F091RC': {'name': 'NUCLEO-F091RC', 'mcuId': 'STM32F091RCTx'},
'NUCLEO_F103RB': {'name': 'NUCLEO-F103RB', 'mcuId': 'STM32F103RBTx'},
'NUCLEO_F207ZG': {'name': 'NUCLEO-F207ZG', 'mcuId': 'STM32F207ZGTx'},
'NUCLEO_F302R8': {'name': 'NUCLEO-F302R8', 'mcuId': 'STM32F302R8Tx'},
'NUCLEO_F303K8': {'name': 'NUCLEO-F303K8', 'mcuId': 'STM32F303K8Tx'},
'NUCLEO_F303RE': {'name': 'NUCLEO-F303RE', 'mcuId': 'STM32F303RETx'},
'NUCLEO_F303ZE': {'name': 'NUCLEO-F303ZE', 'mcuId': 'STM32F303ZETx'},
'NUCLEO_F334R8': {'name': 'NUCLEO-F334R8', 'mcuId': 'STM32F334R8Tx'},
'NUCLEO_F401RE': {'name': 'NUCLEO-F401RE', 'mcuId': 'STM32F401RETx'},
'NUCLEO_F410RB': {'name': 'NUCLEO-F410RB', 'mcuId': 'STM32F410RBTx'},
'NUCLEO_F411RE': {'name': 'NUCLEO-F411RE', 'mcuId': 'STM32F411RETx'},
'NUCLEO_F429ZI': {'name': 'NUCLEO-F429ZI', 'mcuId': 'STM32F429ZITx'},
'NUCLEO_F446RE': {'name': 'NUCLEO-F446RE', 'mcuId': 'STM32F446RETx'},
'NUCLEO_F446ZE': {'name': 'NUCLEO-F446ZE', 'mcuId': 'STM32F446ZETx'},
'NUCLEO_F746ZG': {'name': 'NUCLEO-F746ZG', 'mcuId': 'STM32F746ZGTx'},
'NUCLEO_F767ZI': {'name': 'NUCLEO-F767ZI', 'mcuId': 'STM32F767ZITx'},
'NUCLEO_L011K4': {'name': 'NUCLEO-L011K4', 'mcuId': 'STM32L011K4Tx'},
'NUCLEO_L031K6': {'name': 'NUCLEO-L031K6', 'mcuId': 'STM32L031K6Tx'},
'NUCLEO_L053R8': {'name': 'NUCLEO-L053R8', 'mcuId': 'STM32L053R8Tx'},
'NUCLEO_L073RZ': {'name': 'NUCLEO-L073RZ', 'mcuId': 'STM32L073RZTx'},
'NUCLEO_L152RE': {'name': 'NUCLEO-L152RE', 'mcuId': 'STM32L152RETx'},
'NUCLEO_L432KC': {'name': 'NUCLEO-L432KC', 'mcuId': 'STM32L432KCUx'},
'NUCLEO_L476RG': {'name': 'NUCLEO-L476RG', 'mcuId': 'STM32L476RGTx'},
'B96B_F446VE':
{
'name': 'B96B-F446VE',
'mcuId': 'STM32F446VETx'
},
'DISCO_F051R8':
{
'name': 'STM32F0DISCOVERY',
'mcuId': 'STM32F051R8Tx'
},
'DISCO_F303VC':
{
'name': 'STM32F3DISCOVERY',
'mcuId': 'STM32F303VCTx'
},
'DISCO_F334C8':
{
'name': 'STM32F3348DISCOVERY',
'mcuId': 'STM32F334C8Tx'
},
'DISCO_F401VC':
{
'name': 'STM32F401C-DISCO',
'mcuId': 'STM32F401VCTx'
},
'DISCO_F407VG':
{
'name': 'STM32F4DISCOVERY',
'mcuId': 'STM32F407VGTx'
},
'DISCO_F413ZH':
{
'name': 'DISCO_F413',
'mcuId': 'STM32F413ZHTx'
},
'DISCO_F429ZI':
{
'name': 'STM32F429I-DISCO',
'mcuId': 'STM32F429ZITx'
},
'DISCO_F469NI':
{
'name': 'DISCO-F469NI',
'mcuId': 'STM32F469NIHx'
},
'DISCO_F746NG':
{
'name': 'STM32F746G-DISCO',
'mcuId': 'STM32F746NGHx'
},
'DISCO_F769NI':
{
'name': 'DISCO-F769NI',
'mcuId': 'STM32F769NIHx'
},
'DISCO_L053C8':
{
'name': 'STM32L0538DISCOVERY',
'mcuId': 'STM32L053C8Tx'
},
'DISCO_L072CZ_LRWAN1':
{
'name': 'DISCO-L072CZ-LRWAN1',
'mcuId': 'STM32L072CZTx'
},
'DISCO_L475VG_IOT01A':
{
'name': 'STM32L475G-DISCO',
'mcuId': 'STM32L475VGTx'
},
'DISCO_L476VG':
{
'name': 'STM32L476G-DISCO',
'mcuId': 'STM32L476VGTx'
},
'NUCLEO_F030R8':
{
'name': 'NUCLEO-F030R8',
'mcuId': 'STM32F030R8Tx'
},
'NUCLEO_F031K6':
{
'name': 'NUCLEO-F031K6',
'mcuId': 'STM32F031K6Tx'
},
'NUCLEO_F042K6':
{
'name': 'NUCLEO-F042K6',
'mcuId': 'STM32F042K6Tx'
},
'NUCLEO_F070RB':
{
'name': 'NUCLEO-F070RB',
'mcuId': 'STM32F070RBTx'
},
'NUCLEO_F072RB':
{
'name': 'NUCLEO-F072RB',
'mcuId': 'STM32F072RBTx'
},
'NUCLEO_F091RC':
{
'name': 'NUCLEO-F091RC',
'mcuId': 'STM32F091RCTx'
},
'NUCLEO_F103RB':
{
'name': 'NUCLEO-F103RB',
'mcuId': 'STM32F103RBTx'
},
'NUCLEO_F207ZG':
{
'name': 'NUCLEO-F207ZG',
'mcuId': 'STM32F207ZGTx'
},
'NUCLEO_F302R8':
{
'name': 'NUCLEO-F302R8',
'mcuId': 'STM32F302R8Tx'
},
'NUCLEO_F303K8':
{
'name': 'NUCLEO-F303K8',
'mcuId': 'STM32F303K8Tx'
},
'NUCLEO_F303RE':
{
'name': 'NUCLEO-F303RE',
'mcuId': 'STM32F303RETx'
},
'NUCLEO_F303ZE':
{
'name': 'NUCLEO-F303ZE',
'mcuId': 'STM32F303ZETx'
},
'NUCLEO_F334R8':
{
'name': 'NUCLEO-F334R8',
'mcuId': 'STM32F334R8Tx'
},
'NUCLEO_F401RE':
{
'name': 'NUCLEO-F401RE',
'mcuId': 'STM32F401RETx'
},
'NUCLEO_F410RB':
{
'name': 'NUCLEO-F410RB',
'mcuId': 'STM32F410RBTx'
},
'NUCLEO_F411RE':
{
'name': 'NUCLEO-F411RE',
'mcuId': 'STM32F411RETx'
},
'NUCLEO_F429ZI':
{
'name': 'NUCLEO-F429ZI',
'mcuId': 'STM32F429ZITx'
},
'NUCLEO_F446RE':
{
'name': 'NUCLEO-F446RE',
'mcuId': 'STM32F446RETx'
},
'NUCLEO_F446ZE':
{
'name': 'NUCLEO-F446ZE',
'mcuId': 'STM32F446ZETx'
},
'NUCLEO_F746ZG':
{
'name': 'NUCLEO-F746ZG',
'mcuId': 'STM32F746ZGTx'
},
'NUCLEO_F767ZI':
{
'name': 'NUCLEO-F767ZI',
'mcuId': 'STM32F767ZITx'
},
'NUCLEO_L011K4':
{
'name': 'NUCLEO-L011K4',
'mcuId': 'STM32L011K4Tx'
},
'NUCLEO_L031K6':
{
'name': 'NUCLEO-L031K6',
'mcuId': 'STM32L031K6Tx'
},
'NUCLEO_L053R8':
{
'name': 'NUCLEO-L053R8',
'mcuId': 'STM32L053R8Tx'
},
'NUCLEO_L073RZ':
{
'name': 'NUCLEO-L073RZ',
'mcuId': 'STM32L073RZTx'
},
'NUCLEO_L152RE':
{
'name': 'NUCLEO-L152RE',
'mcuId': 'STM32L152RETx'
},
'NUCLEO_L432KC':
{
'name': 'NUCLEO-L432KC',
'mcuId': 'STM32L432KCUx'
},
'NUCLEO_L476RG':
{
'name': 'NUCLEO-L476RG',
'mcuId': 'STM32L476RGTx'
},
}
TARGETS = BOARDS.keys()
def __gen_dir(self, dirname):
settings = join(self.export_dir, dirname)
def __gen_dir(self, dir_name):
"""
Method that creates directory
"""
settings = join(self.export_dir, dir_name)
mkdir(settings)
def __generate_uid(self):
return "%0.9u" % randint(0, 999999999)
def get_fpu_hardware(self, fpu_unit):
"""
Convert fpu unit name into hardware name.
"""
hw = ''
fpus = {
'fpv4spd16': 'fpv4-sp-d16',
'fpv5d16': 'fpv5-d16',
'fpv5spd16': 'fpv5-sp-d16'
}
if fpu_unit in fpus:
hw = fpus[fpu_unit]
return hw
def process_sw_options(self, opts, flags_in):
"""
Process System Workbench specific options.
System Workbench for STM32 has some compile options, which are not recognized by the GNUARMEclipse exporter.
Those are handled in this method.
"""
opts['c']['preprocess'] = False
if '-E' in flags_in['c_flags']:
opts['c']['preprocess'] = True
opts['cpp']['preprocess'] = False
if '-E' in flags_in['cxx_flags']:
opts['cpp']['preprocess'] = True
opts['c']['slowflashdata'] = False
if '-mslow-flash-data' in flags_in['c_flags']:
opts['c']['slowflashdata'] = True
opts['cpp']['slowflashdata'] = False
if '-mslow-flash-data' in flags_in['cxx_flags']:
opts['cpp']['slowflashdata'] = True
if opts['common']['optimization.messagelength']:
opts['common']['optimization.other'] += ' -fmessage-length=0'
if opts['common']['optimization.signedchar']:
opts['common']['optimization.other'] += ' -fsigned-char'
if opts['common']['optimization.nocommon']:
opts['common']['optimization.other'] += ' -fno-common'
if opts['common']['optimization.noinlinefunctions']:
opts['common']['optimization.other'] += ' -fno-inline-functions'
if opts['common']['optimization.freestanding']:
opts['common']['optimization.other'] += ' -ffreestanding'
if opts['common']['optimization.nobuiltin']:
opts['common']['optimization.other'] += ' -fno-builtin'
if opts['common']['optimization.spconstant']:
opts['common']['optimization.other'] += ' -fsingle-precision-constant'
if opts['common']['optimization.nomoveloopinvariants']:
opts['common']['optimization.other'] += ' -fno-move-loop-invariants'
if opts['common']['warnings.unused']:
opts['common']['warnings.other'] += ' -Wunused'
if opts['common']['warnings.uninitialized']:
opts['common']['warnings.other'] += ' -Wuninitialized'
if opts['common']['warnings.missingdeclaration']:
opts['common']['warnings.other'] += ' -Wmissing-declarations'
if opts['common']['warnings.pointerarith']:
opts['common']['warnings.other'] += ' -Wpointer-arith'
if opts['common']['warnings.padded']:
opts['common']['warnings.other'] += ' -Wpadded'
if opts['common']['warnings.shadow']:
opts['common']['warnings.other'] += ' -Wshadow'
if opts['common']['warnings.logicalop']:
opts['common']['warnings.other'] += ' -Wlogical-op'
if opts['common']['warnings.agreggatereturn']:
opts['common']['warnings.other'] += ' -Waggregate-return'
if opts['common']['warnings.floatequal']:
opts['common']['warnings.other'] += ' -Wfloat-equal'
opts['ld']['strip'] = False
if '-s' in flags_in['ld_flags']:
opts['ld']['strip'] = True
opts['ld']['shared'] = False
if '-shared' in flags_in['ld_flags']:
opts['ld']['shared'] = True
opts['ld']['soname'] = ''
opts['ld']['implname'] = ''
opts['ld']['defname'] = ''
for item in flags_in['ld_flags']:
if item.startswith('-Wl,-soname='):
opts['ld']['soname'] = item[len('-Wl,-soname='):]
if item.startswith('-Wl,--out-implib='):
opts['ld']['implname'] = item[len('-Wl,--out-implib='):]
if item.startswith('-Wl,--output-def='):
opts['ld']['defname'] = item[len('-Wl,--output-def='):]
opts['common']['arm.target.fpu.hardware'] = self.get_fpu_hardware(
opts['common']['arm.target.fpu.unit'])
opts['common']['debugging.codecov'] = False
if '-fprofile-arcs' in flags_in['common_flags'] and '-ftest-coverage' in flags_in['common_flags']:
opts['common']['debugging.codecov'] = True
# Passing linker options to linker with '-Wl,'-prefix.
for index in range(len(opts['ld']['flags'])):
item = opts['ld']['flags'][index]
if not item.startswith('-Wl,'):
opts['ld']['flags'][index] = '-Wl,' + item
# Strange System Workbench feature: If first parameter in Other flags is a
# define (-D...), Other flags will be replaced by defines and other flags
# are completely ignored. Moving -D parameters to defines.
for compiler in ['c', 'cpp', 'as']:
tmpList = opts[compiler]['other'].split(' ')
otherList = []
for item in tmpList:
if item.startswith('-D'):
opts[compiler]['defines'].append(str(item[2:]))
else:
otherList.append(item)
opts[compiler]['other'] = ' '.join(otherList)
# Assembler options
for as_def in opts['as']['defines']:
if '=' in as_def:
opts['as']['other'] += ' --defsym ' + as_def
else:
opts['as']['other'] += ' --defsym ' + as_def + '=1'
def generate(self):
fp_hardware = "no"
fp_abi = "soft"
core = self.toolchain.target.core
if core == "Cortex-M4F" or core == "Cortex-M7F":
fp_hardware = "fpv4-sp-d16"
fp_abi = "soft-fp"
elif core == "Cortex-M7FD":
fp_hardware = "fpv5-d16"
fp_abi = "soft-fp"
"""
Generate the .project and .cproject files.
"""
options = {}
if not self.resources.linker_script:
raise NotSupportedException("No linker script found.")
print ('\nCreate a System Workbench for STM32 managed project')
print ('Project name: {0}'.format(self.project_name))
print ('Target: {0}'.format(self.toolchain.target.name))
print ('Toolchain: {0}'.format(self.TOOLCHAIN) + '\n')
self.resources.win_to_unix()
config_header = self.filter_dot(self.toolchain.get_config_header())
libraries = []
for lib in self.resources.libraries:
l, _ = splitext(basename(lib))
libraries.append(l[3:])
library, _ = splitext(basename(lib))
libraries.append(library[3:])
self.system_libraries = [
'stdc++', 'supc++', 'm', 'c', 'gcc', 'nosys'
]
profiles = self.get_all_profiles()
self.as_defines = [s.replace('"', '&quot;')
for s in self.toolchain.get_symbols(True)]
self.c_defines = [s.replace('"', '&quot;')
for s in self.toolchain.get_symbols()]
self.cpp_defines = self.c_defines
print 'Symbols: {0}'.format(len(self.c_defines))
self.include_path = []
for s in self.resources.inc_dirs:
self.include_path.append("../" + self.filter_dot(s))
print ('Include folders: {0}'.format(len(self.include_path)))
self.compute_exclusions()
print ('Exclude folders: {0}'.format(len(self.excluded_folders)))
ld_script = self.filter_dot(self.resources.linker_script)
print ('Linker script: {0}'.format(ld_script))
lib_dirs = [self.filter_dot(s) for s in self.resources.lib_dirs]
preproc_cmd = basename(self.toolchain.preproc[0]) + " " + " ".join(self.toolchain.preproc[1:])
for id in ['debug', 'release']:
opts = {}
opts['common'] = {}
opts['as'] = {}
opts['c'] = {}
opts['cpp'] = {}
opts['ld'] = {}
opts['id'] = id
opts['name'] = opts['id'].capitalize()
# TODO: Add prints to log or console in verbose mode.
#print ('\nBuild configuration: {0}'.format(opts['name']))
profile = profiles[id]
# A small hack, do not bother with src_path again,
# pass an empty string to avoid crashing.
src_paths = ['']
toolchain = prepare_toolchain(
src_paths, "", self.toolchain.target.name, self.TOOLCHAIN, build_profile=[profile])
# Hack to fill in build_dir
toolchain.build_dir = self.toolchain.build_dir
flags = self.toolchain_flags(toolchain)
# TODO: Add prints to log or console in verbose mode.
# print 'Common flags:', ' '.join(flags['common_flags'])
# print 'C++ flags:', ' '.join(flags['cxx_flags'])
# print 'C flags:', ' '.join(flags['c_flags'])
# print 'ASM flags:', ' '.join(flags['asm_flags'])
# print 'Linker flags:', ' '.join(flags['ld_flags'])
# Most GNU ARM Eclipse options have a parent,
# either debug or release.
if '-O0' in flags['common_flags'] or '-Og' in flags['common_flags']:
opts['parent_id'] = 'debug'
else:
opts['parent_id'] = 'release'
self.process_options(opts, flags)
opts['c']['defines'] = self.c_defines
opts['cpp']['defines'] = self.cpp_defines
opts['as']['defines'] = self.as_defines
self.process_sw_options(opts, flags)
opts['ld']['library_paths'] = [
self.filter_dot(s) for s in self.resources.lib_dirs]
opts['ld']['user_libraries'] = libraries
opts['ld']['system_libraries'] = self.system_libraries
opts['ld']['script'] = "linker-script-" + id + ".ld"
# Unique IDs used in multiple places.
uid = {}
uid['config'] = u.id
uid['tool_c_compiler'] = u.id
uid['tool_c_compiler_input'] = u.id
uid['tool_cpp_compiler'] = u.id
uid['tool_cpp_compiler_input'] = u.id
opts['uid'] = uid
options[id] = opts
ctx = {
'name': self.project_name,
'include_paths': self.resources.inc_dirs,
'linker_script': self.resources.linker_script,
'library_paths': self.resources.lib_dirs,
'platform': platform,
'include_paths': self.include_path,
'config_header': config_header,
'exclude_paths': '|'.join(self.excluded_folders),
'ld_script': ld_script,
'library_paths': lib_dirs,
'object_files': self.resources.objects,
'libraries': libraries,
'symbols': self.toolchain.get_symbols(),
'board_name': self.BOARDS[self.target.upper()]['name'],
'mcu_name': self.BOARDS[self.target.upper()]['mcuId'],
'debug_config_uid': self.__generate_uid(),
'debug_tool_compiler_uid': self.__generate_uid(),
'debug_tool_compiler_input_uid': self.__generate_uid(),
'release_config_uid': self.__generate_uid(),
'release_tool_compiler_uid': self.__generate_uid(),
'release_tool_compiler_input_uid': self.__generate_uid(),
'uid': self.__generate_uid(),
'floating_point_hardware': fp_hardware,
'floating_point_abi': fp_abi
'cpp_cmd': preproc_cmd,
'options': options,
# id property of 'u' will generate new random identifier every time
# when called.
'u': u
}
self.__gen_dir('.settings')
self.gen_file('sw4stm32/language_settings_commom.tmpl', ctx, '.settings/language.settings.xml')
self.gen_file('sw4stm32/language_settings_commom.tmpl',
ctx, '.settings/language.settings.xml')
self.gen_file('sw4stm32/project_common.tmpl', ctx, '.project')
self.gen_file('sw4stm32/cproject_common.tmpl', ctx, '.cproject')
self.gen_file('sw4stm32/makefile.targets.tmpl', ctx,
'makefile.targets', trim_blocks=True, lstrip_blocks=True)
self.gen_file('sw4stm32/launch.tmpl', ctx, self.project_name +
' ' + options['debug']['name'] + '.launch')

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.{{debug_config_uid}}">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.{{debug_config_uid}}" moduleId="org.eclipse.cdt.core.settings" name="Debug">
{% for cfg_id in options %}
{% set opts = options[cfg_id] %}
<cconfiguration id="fr.ac6.managedbuild.config.gnu.cross.exe.{{cfg_id}}.{{opts['uid']['config']}}">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="fr.ac6.managedbuild.config.gnu.cross.exe.{{cfg_id}}.{{opts['uid']['config']}}" moduleId="org.eclipse.cdt.core.settings" name="{{opts['name']}}">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
@ -14,201 +16,300 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.{{debug_config_uid}}" name="Debug" parent="fr.ac6.managedbuild.config.gnu.cross.exe.debug" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.bin&quot; &amp;&amp; arm-none-eabi-size &quot;${BuildArtifactFileName}&quot;">
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.{{debug_config_uid}}." name="/" resourcePath="">
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug.{{uid}}" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug">
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.{{uid}}" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="{{mcu_name}}" valueType="string"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.board.{{uid}}" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" value="{{board_name}}" valueType="string"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.fpu.{{uid}}" name="Floating point hardware" superClass="fr.ac6.managedbuild.option.gnu.cross.fpu" value="fr.ac6.managedbuild.option.gnu.cross.fpu.{{floating_point_hardware}}" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.{{uid}}" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi" value="fr.ac6.managedbuild.option.gnu.cross.floatabi.{{floating_point_abi}}" valueType="enumerated"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.{{uid}}" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/{{name}}}/Debug" id="fr.ac6.managedbuild.builder.gnu.cross.{{uid}}" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.{{debug_tool_compiler_uid}}" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.{{uid}}" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false"/>
<option id="gnu.c.compiler.option.debugging.level.{{uid}}" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.{{uid}}" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<configuration artifactExtension="elf" artifactName="${ProjName}-{{cfg_id}}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.{{cfg_id}}" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.{{cfg_id}}.{{opts['uid']['config']}}" name="{{opts['name']}}" parent="fr.ac6.managedbuild.config.gnu.cross.exe.{{cfg_id}}" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${ProjName}.bin&quot; &amp;&amp; arm-none-eabi-size -B &quot;${BuildArtifactFileName}&quot; &amp;&amp; make ldclean" preannouncebuildStep="Creating makefile.defs:" prebuildStep="echo &quot;export PREPROC_CMD = ${openstm32_compiler_path}/${compiler_prefix}cpp -E -P&quot; &gt; ${ProjDirPath}/makefile.defs">
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.{{cfg_id}}.{{opts['uid']['config']}}." name="/" resourcePath="">
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.{{cfg_id}}.{{u.id}}" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.{{cfg_id}}">
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.{{u.id}}" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="{{mcu_name}}" valueType="string"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.board.{{u.id}}" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" value="{{board_name}}" valueType="string"/>
{% if opts['common']['arm.target.fpu.hardware'] %}
<option id="fr.ac6.managedbuild.option.gnu.cross.fpu.{{u.id}}" name="Floating point hardware" superClass="fr.ac6.managedbuild.option.gnu.cross.fpu" value="fr.ac6.managedbuild.option.gnu.cross.fpu.{{opts['common']['arm.target.fpu.hardware']}}" valueType="enumerated"/>
{% endif %}
{% if opts['common']['arm.target.fpu.abi'] %}
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.{{u.id}}" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi" value="fr.ac6.managedbuild.option.gnu.cross.floatabi.{{opts['common']['arm.target.fpu.abi']}}" valueType="enumerated"/>
{% endif %}
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.{{u.id}}" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/{{name}}}/{{opts['name']}}" id="fr.ac6.managedbuild.builder.gnu.cross.{{u.id}}" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.{{opts['uid']['tool_c_compiler']}}" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
{% if cfg_id == 'debug' %}
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.{{u.id}}" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.more" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.{{u.id}}" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
{% else %}
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.{{u.id}}" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.most" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.{{u.id}}" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
{% endif %}
<option id="gnu.c.compiler.option.include.paths.{{u.id}}" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
{% for path in include_paths %}
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/{{path}}&quot;"/>
<listOptionValue builtIn="false" value="&quot;{{path}}&quot;"/>
{% endfor %}
</option>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.{{uid}}" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
{% for s in symbols %}
<option id="gnu.c.compiler.option.preprocessor.def.symbols.{{u.id}}" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
{% for s in opts['c']['defines'] %}
<listOptionValue builtIn="false" value="{{s}}"/>
{% endfor %}
</option>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{release_tool_compiler_input_uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
{% if config_header %}
<option id="gnu.c.compiler.option.include.files.{{u.id}}" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles">
<listOptionValue builtIn="false" value="${ProjDirPath}/{{config_header}}"/>
</option>
{% endif %}
{% if 'compiler.std' in opts['c'] %}
{% if opts['c']['compiler.std'] == '-ansi' %}
<option id="gnu.c.compiler.option.misc.ansi.{{u.id}}" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% elif opts['c']['compiler.std'] %}
<option id="gnu.c.compiler.option.dialect.std.{{u.id}}" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.{{opts['c']['compiler.std']}}" valueType="enumerated"/>
<option id="gnu.c.compiler.option.dialect.std.{{u.id}}" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.c99" valueType="enumerated"/>
{% endif %}
{% endif %}
{% if opts['common']['warnings.pedantic'] %}
<option id="gnu.c.compiler.option.warnings.pedantic.{{u.id}}" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.pedanticerrors'] %}
<option id="gnu.c.compiler.option.warnings.pedantic.error.{{u.id}}" name="Pedantic warnings as errors (-pedantic-errors)" superClass="gnu.c.compiler.option.warnings.pedantic.error" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['c']['nostdinc'] %}
<option id="gnu.c.compiler.option.preprocessor.nostdinc.{{u.id}}" name="Do not search system directories (-nostdinc)" superClass="gnu.c.compiler.option.preprocessor.nostdinc" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['c']['preprocess'] %}
<option id="gnu.c.compiler.option.preprocessor.preprocess.{{u.id}}" name="Preprocess only (-E)" superClass="gnu.c.compiler.option.preprocessor.preprocess" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.syntaxonly'] %}
<option id="gnu.c.compiler.option.warnings.syntax.{{u.id}}" name="Check syntax only (-fsyntax-only)" superClass="gnu.c.compiler.option.warnings.syntax" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.nowarn'] %}
<option id="gnu.c.compiler.option.warnings.nowarn.{{u.id}}" name="Inhibit all warnings (-w)" superClass="gnu.c.compiler.option.warnings.nowarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.extrawarn'] %}
<option id="gnu.c.compiler.option.warnings.extrawarn.{{u.id}}" name="Extra warnings (-Wextra)" superClass="gnu.c.compiler.option.warnings.extrawarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.toerrors'] %}
<option id="gnu.c.compiler.option.warnings.toerrors.{{u.id}}" name="Warnings as errors (-Werror)" superClass="gnu.c.compiler.option.warnings.toerrors" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.conversion'] %}
<option id="gnu.c.compiler.option.warnings.wconversion.{{u.id}}" name="Implicit conversion warnings (-Wconversion)" superClass="gnu.c.compiler.option.warnings.wconversion" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['debugging.prof'] %}
<option id="gnu.c.compiler.option.debugging.prof.{{u.id}}" name="Generate prof information (-p)" superClass="gnu.c.compiler.option.debugging.prof" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['debugging.gprof'] %}
<option id="gnu.c.compiler.option.debugging.gprof.{{u.id}}" name="Generate gprof information (-pg)" superClass="gnu.c.compiler.option.debugging.gprof" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['debugging.codecov'] %}
<option id="gnu.c.compiler.option.debugging.codecov.{{u.id}}" superClass="gnu.c.compiler.option.debugging.codecov" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['c']['verbose'] %}
<option id="gnu.c.compiler.option.misc.verbose.{{u.id}}" name="Verbose (-v)" superClass="gnu.c.compiler.option.misc.verbose" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['optimization.PIC'] %}
<option id="gnu.c.compiler.option.misc.pic.{{u.id}}" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['optimization.datasections'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.fdata.{{u.id}}" name="Place the data in their own section (-fdata-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.fdata" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['optimization.functionsections'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction.{{u.id}}" name="Place the function in their own section (-ffunction-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['c']['otheroptimizations'] != '' or opts['common']['optimization.other'] != '' %}
<option id="gnu.c.compiler.option.optimization.flags.{{u.id}}" superClass="gnu.c.compiler.option.optimization.flags" useByScannerDiscovery="false" value="{{opts['c']['otheroptimizations']}} {{opts['common']['optimization.other']}}" valueType="string"/>
{% endif %}
{% if opts['c']['other'] != '' or opts['c']['otherwarnings'] != '' or opts['common']['warnings.other'] != '' %}
<option id="fr.ac6.managedbuid.gnu.c.compiler.option.misc.other.{{u.id}}" name="Other flags" superClass="fr.ac6.managedbuid.gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="{{opts['c']['other']}} {{opts['c']['otherwarnings']}} {{opts['common']['warnings.other']}}" valueType="string"/>
{% endif %}
{% if opts['c']['slowflashdata'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.pcrop.{{u.id}}" name="No data reads in code memory (-mslow-flash-data) " superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.pcrop" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{opts['uid']['tool_c_compiler_input']}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.{{u.id}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.{{uid}}" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.{{uid}}" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false"/>
<option id="gnu.cpp.compiler.option.debugging.level.{{uid}}" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.{{uid}}" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.{{opts['uid']['tool_cpp_compiler']}}" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
{% if cfg_id == 'debug' %}
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.{{u.id}}" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false"/>
<option id="gnu.cpp.compiler.option.debugging.level.{{u.id}}" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
{% else %}
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.{{u.id}}" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.{{u.id}}" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
{% endif %}
<option id="gnu.cpp.compiler.option.include.paths.{{u.id}}" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
{% for path in include_paths %}
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/{{path}}&quot;"/>
<listOptionValue builtIn="false" value="&quot;{{path}}&quot;"/>
{% endfor %}
</option>
<option id="gnu.cpp.compiler.option.dialect.std.{{uid}}" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.preprocessor.def{{uid}}" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
{% for s in symbols %}
<option id="gnu.cpp.compiler.option.preprocessor.def.{{u.id}}" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
{% for s in opts['cpp']['defines'] %}
<listOptionValue builtIn="false" value="{{s}}"/>
{% endfor %}
</option>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s"/>
{% if config_header %}
<option id="gnu.cpp.compiler.option.include.files.{{u.id}}" name="Include files (-include)" superClass="gnu.cpp.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles">
<listOptionValue builtIn="false" value="${ProjDirPath}/{{config_header}}"/>
</option>
{% endif %}
{% if 'compiler.std' in opts['cpp'] %}
{% if opts['cpp']['compiler.std'] %}
<option id="gnu.cpp.compiler.option.dialect.std.{{u.id}}" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.{{opts['c']['compiler.std']}}" valueType="enumerated"/>
{% endif %}
{% endif %}
{% if opts['common']['warnings.pedantic'] %}
<option id="gnu.cpp.compiler.option.warnings.pedantic.{{u.id}}" superClass="gnu.cpp.compiler.option.warnings.pedantic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.pedanticerrors'] %}
<option id="gnu.cpp.compiler.option.warnings.pedantic.error.{{u.id}}" superClass="gnu.cpp.compiler.option.warnings.pedantic.error" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['c']['nostdinc'] %}
<option id="gnu.cpp.compiler.option.preprocessor.nostdinc.{{u.id}}" superClass="gnu.cpp.compiler.option.preprocessor.nostdinc" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['c']['preprocess'] %}
<option id="gnu.cpp.compiler.option.preprocessor.preprocess.{{u.id}}" superClass="gnu.cpp.compiler.option.preprocessor.preprocess" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.syntaxonly'] %}
<option id="gnu.cpp.compiler.option.warnings.syntax.{{u.id}}" superClass="gnu.cpp.compiler.option.warnings.syntax" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.nowarn'] %}
<option id="gnu.cpp.compiler.option.warnings.nowarn.{{u.id}}" superClass="gnu.cpp.compiler.option.warnings.nowarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
<option id="gnu.cpp.compiler.option.warnings.allwarn.{{u.id}}" superClass="gnu.cpp.compiler.option.warnings.allwarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% if opts['common']['warnings.extrawarn'] %}
<option id="gnu.cpp.compiler.option.warnings.extrawarn.{{u.id}}" superClass="gnu.cpp.compiler.option.warnings.extrawarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.toerrors'] %}
<option id="gnu.cpp.compiler.option.warnings.toerrors.{{u.id}}" superClass="gnu.cpp.compiler.option.warnings.toerrors" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['warnings.conversion'] %}
<option id="gnu.cpp.compiler.option.warnings.wconversion.{{u.id}}" superClass="gnu.cpp.compiler.option.warnings.wconversion" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['debugging.prof'] %}
<option id="gnu.cpp.compiler.option.debugging.prof.{{u.id}}" superClass="gnu.cpp.compiler.option.debugging.prof" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['debugging.gprof'] %}
<option id="gnu.cpp.compiler.option.debugging.gprof.{{u.id}}" superClass="gnu.cpp.compiler.option.debugging.gprof" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['debugging.codecov'] %}
<option id="gnu.cpp.compiler.option.debugging.codecov.{{u.id}}" superClass="gnu.cpp.compiler.option.debugging.codecov" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['c']['verbose'] %}
<option id="gnu.cpp.compiler.option.other.verbose.{{u.id}}" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['optimization.PIC'] %}
<option id="gnu.cpp.compiler.option.other.pic.{{u.id}}" superClass="gnu.cpp.compiler.option.other.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['optimization.datasections'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.fdata.{{u.id}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.fdata" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['optimization.functionsections'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction.{{u.id}}" name="Place the function in their own section (-ffunction-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['cpp']['otheroptimizations'] != '' or opts['common']['optimization.other'] != '' %}
<option id="gnu.cpp.compiler.option.optimization.flags.{{u.id}}" superClass="gnu.cpp.compiler.option.optimization.flags" useByScannerDiscovery="false" value="{{opts['cpp']['otheroptimizations']}} {{opts['common']['optimization.other']}}" valueType="string"/>
{% endif %}
{% if opts['cpp']['other'] != '' or opts['cpp']['otherwarnings'] != '' or opts['common']['warnings.other'] != '' %}
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.misc.other.{{u.id}}" name="Other flags" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.misc.other" useByScannerDiscovery="false" value="{{opts['cpp']['other']}} {{opts['cpp']['otherwarnings']}} {{opts['common']['warnings.other']}}" valueType="string"/>
{% endif %}
{% if opts['cpp']['slowflashdata'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.pcrop.{{u.id}}" name="No data reads in code memory (-mslow-flash-data) " superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.pcrop" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.{{opts['uid']['tool_cpp_compiler_input']}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s.{{u.id}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.{{uid}}" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker">
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.{{uid}}" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.{{uid}}" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker">
<option id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.script.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.script" value="${workspace_loc:/${ProjName}/{{linker_script}}}" valueType="string"/>
<option id="gnu.cpp.link.option.flags.{{uid}}" superClass="gnu.cpp.link.option.flags" value="--specs=nano.specs" valueType="string"/>
<option id="gnu.cpp.link.option.userobjs.{{uid}}" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.{{u.id}}" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker">
<option id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.script.{{u.id}}" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.script" value="${ProjDirPath}/{{opts['name']}}/{{opts['ld']['script']}}" valueType="string"/>
{% if opts['ld']['flags'] != '' or opts['ld']['other'] != '' %}
<option id="gnu.cpp.link.option.flags.{{u.id}}" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="{{ opts['ld']['flags']|join(' ') }} {{opts['ld']['other']}}" valueType="string"/>
{% endif %}
<option id="gnu.cpp.link.option.userobjs.{{u.id}}" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
{% for path in object_files %}
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/{{path}}}&quot;"/>
{% endfor %}
</option>
<option id="gnu.cpp.link.option.libs.{{uid}}" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<option id="gnu.cpp.link.option.libs.{{u.id}}" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
{% for lib in libraries %}
<listOptionValue builtIn="false" value="{{lib}}"/>
{% endfor %}
</option>
<option id="gnu.cpp.link.option.paths.{{uid}}" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
{% if opts['ld']['nostart'] %}
<option id="gnu.cpp.link.option.nostart.{{u.id}}" name="Do not use standard start files (-nostartfiles)" superClass="gnu.cpp.link.option.nostart" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['ld']['nodeflibs'] %}
<option id="gnu.cpp.link.option.nodeflibs.{{u.id}}" superClass="gnu.cpp.link.option.nodeflibs" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['ld']['nostdlibs'] %}
<option id="gnu.cpp.link.option.nostdlibs.{{u.id}}" superClass="gnu.cpp.link.option.nostdlibs" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['ld']['strip'] %}
<option id="gnu.cpp.link.option.strip.{{u.id}}" superClass="gnu.cpp.link.option.strip" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['ld']['shared'] %}
<option id="gnu.cpp.link.option.shared.{{u.id}}" superClass="gnu.cpp.link.option.shared" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['ld']['soname'] != '' %}
<option id="gnu.cpp.link.option.soname.{{u.id}}" superClass="gnu.cpp.link.option.soname" useByScannerDiscovery="false" value="{{opts['ld']['soname']}}" valueType="string"/>
{% endif %}
{% if opts['ld']['implname'] != '' %}
<option id="gnu.cpp.link.option.implname.{{u.id}}" superClass="gnu.cpp.link.option.implname" useByScannerDiscovery="false" value="{{opts['ld']['implname']}}" valueType="string"/>
{% endif %}
{% if opts['ld']['defname'] != '' %}
<option id="gnu.cpp.link.option.defname.{{u.id}}" superClass="gnu.cpp.link.option.defname" useByScannerDiscovery="false" value="{{opts['ld']['defname']}}" valueType="string"/>
{% endif %}
{% if opts['common']['debugging.prof'] %}
<option id="gnu.cpp.link.option.debugging.prof.{{u.id}}" superClass="gnu.cpp.link.option.debugging.prof" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['debugging.gprof'] %}
<option id="gnu.cpp.link.option.debugging.gprof.{{u.id}}" superClass="gnu.cpp.link.option.debugging.gprof" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% if opts['common']['debugging.codecov'] %}
<option id="gnu.cpp.link.option.debugging.codecov.{{u.id}}" superClass="gnu.cpp.link.option.debugging.codecov" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.{{u.id}}" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
<option id="gnu.cpp.link.option.paths.{{u.id}}" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
{% for path in library_paths %}
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/{{path}}}&quot;"/>
{% endfor %}
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.{{uid}}" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool> <tool id="fr.ac6.managedbuild.tool.gnu.archiver.{{uid}}" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.{{uid}}" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler">
<option id="gnu.both.asm.option.include.paths.{{uid}}" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
{% for path in include_paths %}
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/{{path}}&quot;"/>
{% endfor %}
</option>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.{{uid}}" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="fr.ac6.managedbuild.config.gnu.cross.exe.release.{{release_config_uid}}">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.{{release_config_uid}}" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.{{release_config_uid}}" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.bin&quot; &amp;&amp; arm-none-eabi-size -B &quot;${BuildArtifactFileName}&quot;">
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.release.{{release_config_uid}}." name="/" resourcePath="">
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release.{{uid}}" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release">
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.{{uid}}" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="{{mcu_name}}" valueType="string"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.board.{{uid}}" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" value="{{board_name}}" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.{{uid}}" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/{{name}}}/Release" id="fr.ac6.managedbuild.builder.gnu.cross.{{uid}}" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.{{release_tool_compiler_uid}}" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.{{uid}}" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.most" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.{{uid}}" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.{{uid}}" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
{% for path in include_paths %}
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/{{path}}&quot;"/>
{% endfor %}}
</option>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.{{uid}}" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
{% for s in symbols %}
<listOptionValue builtIn="false" value="{{s}}"/>
{% endfor %}
</option>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{debug_tool_compiler_input_uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.{{uid}}" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.{{uid}}" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.{{uid}}" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.{{uid}}" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.{{u.id}}" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.{{u.id}}" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler">
<option id="gnu.both.asm.option.include.paths.{{u.id}}" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
{% for path in include_paths %}
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/{{path}}&quot;"/>
<listOptionValue builtIn="false" value="&quot;{{path}}&quot;"/>
{% endfor %}
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def{{uid}}" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
{% for s in symbols %}
<listOptionValue builtIn="false" value="{{s}}"/>
{% if opts['as']['other'] != '' or opts['as']['otherwarnings'] != '' %}
<option id="gnu.both.asm.option.flags.{{u.id}}" superClass="gnu.both.asm.option.flags" useByScannerDiscovery="false" value="{{opts['as']['other']}} {{opts['as']['otherwarnings']}}" valueType="string"/>
{% endif %}
{% for item in opts['as']['otherwarnings'] %}
{% if item == '-W' %}
<option id="gnu.both.asm.option.warnings.nowarn.{{u.id}}" superClass="gnu.both.asm.option.warnings.nowarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %}
{% endfor %}
</option>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.{{uid}}" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker">
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.{{uid}}" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.{{uid}}" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker">
<option id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.script.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.script" value="${workspace_loc:/${ProjName}/{{linker_script}}}" valueType="string"/>
<option id="gnu.cpp.link.option.flags.{{uid}}" superClass="gnu.cpp.link.option.flags" value="--specs=nano.specs" valueType="string"/>
<option id="gnu.cpp.link.option.userobjs.{{uid}}" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
{% for path in object_files %}
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/{{path}}}&quot;"/>
{% endfor %}
</option>
<option id="gnu.cpp.link.option.libs.{{uid}}" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
{% for lib in libraries %}
<listOptionValue builtIn="false" value="{{lib}}"/>
{% endfor %}
</option>
<option id="gnu.cpp.link.option.paths.{{uid}}" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
{% for path in library_paths %}
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/{{path}}}&quot;"/>
{% endfor %}
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.{{uid}}" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.{{uid}}" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.{{uid}}" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler">
<option id="gnu.both.asm.option.include.paths.{{uid}}" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
{% for path in include_paths %}
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/{{path}}&quot;"/>
{% endfor %}
</option>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.{{uid}}" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.{{u.id}}" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.{{u.id}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="{{exclude_paths}}" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
{% endfor %}
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="{{name}}.fr.ac6.managedbuild.target.gnu.cross.exe.{{uid}}" name="Executable" projectType="fr.ac6.managedbuild.target.gnu.cross.exe"/>
<project id="{{name}}.fr.ac6.managedbuild.target.gnu.cross.exe.{{u.id}}" name="Executable" projectType="fr.ac6.managedbuild.target.gnu.cross.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.release.{{release_config_uid}};fr.ac6.managedbuild.config.gnu.cross.exe.release.{{release_config_uid}}.;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.{{release_tool_compiler_uid}};fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{debug_tool_compiler_input_uid}}">
{% for cfg_key in options %}
{% set opts = options[cfg_key] %}
<scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.{{opts['id']}}.{{opts['uid']['config']}};fr.ac6.managedbuild.config.gnu.cross.exe.{{opts['id']}}.{{opts['uid']['config']}}.;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.{{opts['uid']['tool_c_compiler']}};fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{opts['uid']['tool_c_compiler_input']}}">
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.debug.{{debug_config_uid}};fr.ac6.managedbuild.config.gnu.cross.exe.debug.{{debug_config_uid}}.;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.{{debug_tool_compiler_uid}};fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{release_tool_compiler_input_uid}}">
<scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.{{opts['id']}}.{{opts['uid']['config']}};fr.ac6.managedbuild.config.gnu.cross.exe.{{opts['id']}}.{{opts['uid']['config']}}.;fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.{{opts['uid']['tool_cpp_compiler']}};fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.{{opts['uid']['tool_cpp_compiler_input']}}">
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
{% endfor %}
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>

View File

@ -1,25 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.{{debug_config_uid}}" name="Debug">
{% for cfg_id in options %}
{% set opts = options[cfg_id] %}
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.{{cfg_id}}.{{opts['uid']['config']}}" name="{{opts['name']}}">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1343080084626211886" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.release.{{release_config_uid}}" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1343080084626211886" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1025524915312781673" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
{% endfor %}
</project>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="fr.ac6.mcu.debug.config.launchConfigurationType">
<stringAttribute key="DEBBUGER_BOARD_NAME" value="{{board_name}}"/>
<stringAttribute key="DEBBUGER_MCU_NAME" value="{{mcu_name}}"/>
<stringAttribute key="fr.ac6.mcu.ide.DBG_DEVICE" value="ST-Link"/>
<stringAttribute key="fr.ac6.mcu.ide.DBG_DEVICE_SHAREABLE_ALLOWED" value="false"/>
<stringAttribute key="fr.ac6.mcu.ide.DBG_INTERFACE" value="SWD"/>
<stringAttribute key="fr.ac6.mcu.ide.DBG_INTERFACE_FREQUENCY" value="4000000.0"/>
<stringAttribute key="fr.ac6.mcu.ide.DBG_LOW_POWER_MODE_ALLOWED" value="true"/>
<stringAttribute key="fr.ac6.mcu.ide.DBG_RESET_MODE" value="connect_under_reset"/>
<stringAttribute key="fr.ac6.mcu.ide.DBG_STOP_WATCHDOG_THEN_HALTED_ALLOWED" value="true"/>
<booleanAttribute key="fr.ac6.mcu.ide.OPENOCD_GENERATOR_OPTION" value="false"/>
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_NAME" value="&quot;${openstm32_openocd_path}{% if platform == 'win32' %}\{% else %}/{% endif %}openocd{% if platform == 'win32' %}.exe{% endif %}&quot;"/>
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_OTHER_OPTIONS" value=""/>
{% set cfg_id = 'debug' %}
{% set opts = options[cfg_id] %}
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_SCRIPT" value="{{opts['name']}}{% if platform == 'win32' %}\{% else %}/{% endif %}{{name}} {{opts['name']}}.cfg"/>
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_SCRIPT_CHOICE" value="automated"/>
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_SCRIPT_IS_LEGACY" value="false"/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="3"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value="monitor reset halt"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="Generic TCP/IP"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="${openstm32_compiler_path}{% if platform == 'win32' %}\{% else %}/{% endif %}arm-none-eabi-gdb"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="{{opts['name']}}{% if platform == 'win32' %}\{% else %}/{% endif %}{{name}}-{{cfg_id}}.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="{{name}}"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="fr.ac6.managedbuild.config.gnu.cross.exe.{{cfg_id}}.{{opts['uid']['config']}}"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/{{name}}"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.{{cfg_id}}"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#13;&#10;"/>
<stringAttribute key="process_factory_id" value="fr.ac6.mcu.debug.launching.MCUGdbProcessFactory"/>
</launchConfiguration>

View File

@ -0,0 +1,16 @@
# DO NOT REMOVE! Generated by the SW4STM32 exporter from the mbed project.
PREPROC_CMD ?= {{cpp_cmd}}
ldclean:
{% for config, opts in options.iteritems() %}
$(RM) {{opts['ld']['script']}}
{% endfor %}
{% for config, opts in options.iteritems() %}
{{opts['ld']['script']}}: ../{{ld_script}}
$(PREPROC_CMD) {{opts.ld.other}} $< -o $@
{{name}}-{{config}}.elf: {{opts['ld']['script']}}
{% endfor %}