Skip to content

rtl8195am - fix ci-test issues with ARM compiler #6061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f639777
nrf5x: gpiote uninit only needs to be run if input pin is configured …
pi-anl Feb 6, 2018
d306798
rtl8195am - fix ci-test issues with ARM compiler
M-ichae-l Feb 12, 2018
166a463
Correct single file excludes for some exporters
theotherjimmy Feb 20, 2018
0bc386a
tools: Let unicode error messages through
geky Feb 21, 2018
72b0a07
retarget: Fix path behaviour without leading slash
geky Feb 21, 2018
5aaad08
sleep_manager_racecondition: fix for slow devices
maciejbocianski Feb 22, 2018
cef93db
Merge branch 'master' into mbed_ci-test-fixed_rtl8195am_12/2/2018
prashantrar Feb 22, 2018
34ef116
fix issue 6150 by always setting net interface UP in mbed_set_dhcp
Feb 22, 2018
414b2d9
Revert "Update Mbed TLS HW acceleration partner code to new hashing API"
0xc0170 Feb 22, 2018
a9cd470
LPC546XX: Add support for 220MHz core speed available on LPC54628
mmahadevan108 Feb 20, 2018
069c80b
ff_lpc546xx: Add support for 220MHz core speed.
mmahadevan108 Feb 20, 2018
56ec718
Merge pull request #6163 from ARMmbed/revert-5973-IOTSSL-1727-update-…
cmonr Feb 22, 2018
6c4654a
Merge pull request #6154 from ARMmbed/g-fix-unicode-errors
cmonr Feb 22, 2018
d9cb00d
Merge pull request #6145 from theotherjimmy/exclude-file-gnuarmeclipse
cmonr Feb 22, 2018
0aeeece
FlashIAP driver modifications:
Feb 20, 2018
d44f999
Merge pull request #6156 from geky/fix-path-leading-slash
cmonr Feb 23, 2018
bf2f24f
Merge pull request #6147 from codeauroraforum/Increase_Speed_LPC54628
cmonr Feb 23, 2018
ee64c9c
Merge pull request #6021 from andrewleech/gpiote_uninit
cmonr Feb 23, 2018
55f710f
Merge pull request #6162 from maciejbocianski/sleep_manager_racecondi…
cmonr Feb 23, 2018
1d1eef4
Merge pull request #6160 from TeemuKultala/status_callback_fix
cmonr Feb 23, 2018
1079767
Merge pull request #6140 from davidsaada/david_flashiap_xsectors
0xc0170 Feb 23, 2018
953eaa4
rtl8195am - fix ci-test issues with ARM compiler
M-ichae-l Feb 12, 2018
6623238
Merge branch 'mbed_ci-test-fixed_rtl8195am_12/2/2018' of https://gith…
M-ichae-l Feb 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 51 additions & 6 deletions TESTS/mbed_drivers/flashiap/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,56 @@ void flashiap_program_test()
TEST_ASSERT_EQUAL_INT32(0, ret);
}

void flashiap_cross_sector_program_test()
{
FlashIAP flash_device;
uint32_t ret = flash_device.init();
TEST_ASSERT_EQUAL_INT32(0, ret);

uint32_t page_size = flash_device.get_page_size();

// Erase last two sectors
uint32_t address = flash_device.get_flash_start() + flash_device.get_flash_size();
uint32_t sector_size, agg_size = 0;
for (uint32_t i = 0; i < 2; i++) {
sector_size = flash_device.get_sector_size(address - 1UL);
TEST_ASSERT_NOT_EQUAL(0, sector_size);
TEST_ASSERT_TRUE(sector_size % page_size == 0);
agg_size += sector_size;
address -= sector_size;
}
ret = flash_device.erase(address, agg_size);
TEST_ASSERT_EQUAL_INT32(0, ret);

address += sector_size - page_size;
uint32_t aligned_prog_size = 2 * page_size;
uint32_t prog_size = aligned_prog_size;
if (page_size > 1) {
prog_size--;
}
uint8_t *data = new uint8_t[aligned_prog_size];
for (uint32_t i = 0; i < prog_size; i++) {
data[i] = rand() % 256;
}
for (uint32_t i = prog_size; i < aligned_prog_size; i++) {
data[i] = 0xFF;
}

ret = flash_device.program(data, address, prog_size);
TEST_ASSERT_EQUAL_INT32(0, ret);

uint8_t *data_flashed = new uint8_t[aligned_prog_size];
ret = flash_device.read(data_flashed, address, aligned_prog_size);
TEST_ASSERT_EQUAL_INT32(0, ret);
TEST_ASSERT_EQUAL_UINT8_ARRAY(data, data_flashed, aligned_prog_size);

delete[] data;
delete[] data_flashed;

ret = flash_device.deinit();
TEST_ASSERT_EQUAL_INT32(0, ret);
}

void flashiap_program_error_test()
{
FlashIAP flash_device;
Expand Down Expand Up @@ -111,12 +161,6 @@ void flashiap_program_error_test()
TEST_ASSERT_EQUAL_INT32(-1, ret);
}

if (flash_device.get_page_size() > 1) {
// unaligned page size
ret = flash_device.program(data, address, page_size + 1);
TEST_ASSERT_EQUAL_INT32(-1, ret);
}

delete[] data;

ret = flash_device.deinit();
Expand All @@ -126,6 +170,7 @@ void flashiap_program_error_test()
Case cases[] = {
Case("FlashIAP - init", flashiap_init_test),
Case("FlashIAP - program", flashiap_program_test),
Case("FlashIAP - program across sectors", flashiap_cross_sector_program_test),
Case("FlashIAP - program errors", flashiap_program_error_test),
};

Expand Down
6 changes: 3 additions & 3 deletions TESTS/mbed_hal/sleep_manager_racecondition/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ void sleep_manager_irq_test()
Ticker ticker1;
Timer timer;

ticker1.attach_us(&sleep_manager_locking_irq_test, 500);
ticker1.attach_us(&sleep_manager_locking_irq_test, 1000);

// run this for 5 seconds
// run this for 10 seconds
timer.start();
int start = timer.read();
int end = start + 5;
int end = start + 10;
while (timer.read() < end) {
sleep_manager_locking_irq_test();
}
Expand Down
61 changes: 0 additions & 61 deletions TESTS/mbedtls/multi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,67 +23,6 @@

#include "mbedtls/sha256.h"

/**
* \name SECTION: Compatibility code
*
* Depending on whether the alternative (hatdware accelerated) hashing
* functions are provided or not, different API should be used for hashing.
* \{
*/

#if defined(MBEDTLS_SHA256_ALT)

/**
* \brief This function starts a SHA-256 checksum calculation.
*
* \deprecated Superseded by mbedtls_sha256_starts_ret() in 2.7.0.
*
* \param ctx The SHA-256 context to initialize.
* \param is224 Determines which function to use.
* <ul><li>0: Use SHA-256.</li>
* <li>1: Use SHA-224.</li></ul>
*/
void mbedtls_sha256_starts( mbedtls_sha256_context *ctx,
int is224 )
{
mbedtls_sha256_starts_ret( ctx, is224 );
}

/**
* \brief This function feeds an input buffer into an ongoing
* SHA-256 checksum calculation.
*
* \deprecated Superseded by mbedtls_sha256_update_ret() in 2.7.0.
*
* \param ctx The SHA-256 context to initialize.
* \param input The buffer holding the data.
* \param ilen The length of the input data.
*/
void mbedtls_sha256_update( mbedtls_sha256_context *ctx,
const unsigned char *input,
size_t ilen )
{
mbedtls_sha256_update_ret( ctx, input, ilen );
}

/**
* \brief This function finishes the SHA-256 operation, and writes
* the result to the output buffer.
*
* \deprecated Superseded by mbedtls_sha256_finish_ret() in 2.7.0.
*
* \param ctx The SHA-256 context.
* \param output The SHA-224or SHA-256 checksum result.
*/
void mbedtls_sha256_finish( mbedtls_sha256_context *ctx,
unsigned char output[32] )
{
mbedtls_sha256_finish_ret( ctx, output );
}

#endif /* defined(MBEDTLS_SHA256_ALT) */

/* \} name SECTION: Compatibility code */

using namespace utest::v1;

Expand Down
62 changes: 47 additions & 15 deletions drivers/FlashIAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* SOFTWARE.
*/

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include "FlashIAP.h"
#include "mbed_assert.h"

Expand Down Expand Up @@ -57,6 +59,9 @@ int FlashIAP::init()
if (flash_init(&_flash)) {
ret = -1;
}
uint32_t page_size = get_page_size();
_page_buf = new uint8_t[page_size];

_mutex->unlock();
return ret;
}
Expand All @@ -68,6 +73,7 @@ int FlashIAP::deinit()
if (flash_free(&_flash)) {
ret = -1;
}
delete[] _page_buf;
_mutex->unlock();
return ret;
}
Expand All @@ -85,22 +91,43 @@ int FlashIAP::read(void *buffer, uint32_t addr, uint32_t size)
int FlashIAP::program(const void *buffer, uint32_t addr, uint32_t size)
{
uint32_t page_size = get_page_size();
uint32_t current_sector_size = flash_get_sector_size(&_flash, addr);
// addr and size should be aligned to page size, and multiple of page size
// page program should not cross sector boundaries
if (!is_aligned(addr, page_size) ||
!is_aligned(size, page_size) ||
(size < page_size) ||
(((addr % current_sector_size) + size) > current_sector_size)) {
uint32_t flash_size = flash_get_size(&_flash);
uint32_t flash_start_addr = flash_get_start_address(&_flash);
uint32_t chunk, prog_size;
const uint8_t *buf = (uint8_t *) buffer;
const uint8_t *prog_buf;

// addr should be aligned to page size
if (!is_aligned(addr, page_size) || (!buffer) ||
((addr + size) > (flash_start_addr + flash_size))) {
return -1;
}

int ret = 0;
_mutex->lock();
if (flash_program_page(&_flash, addr, (const uint8_t *)buffer, size)) {
ret = -1;
while (size) {
uint32_t current_sector_size = flash_get_sector_size(&_flash, addr);
chunk = std::min(current_sector_size - (addr % current_sector_size), size);
if (chunk < page_size) {
memcpy(_page_buf, buf, chunk);
memset(_page_buf + chunk, 0xFF, page_size - chunk);
prog_buf = _page_buf;
prog_size = page_size;
} else {
chunk = chunk / page_size * page_size;
prog_buf = buf;
prog_size = chunk;
}
if (flash_program_page(&_flash, addr, prog_buf, prog_size)) {
ret = -1;
break;
}
size -= chunk;
addr += chunk;
buf += chunk;
}
_mutex->unlock();

return ret;
}

Expand All @@ -117,10 +144,19 @@ bool FlashIAP::is_aligned_to_sector(uint32_t addr, uint32_t size)

int FlashIAP::erase(uint32_t addr, uint32_t size)
{
uint32_t current_sector_size = 0UL;
uint32_t current_sector_size;
uint32_t flash_size = flash_get_size(&_flash);
uint32_t flash_start_addr = flash_get_start_address(&_flash);
uint32_t flash_end_addr = flash_start_addr + flash_size;
uint32_t erase_end_addr = addr + size;

if (!is_aligned_to_sector(addr, size)) {
if (erase_end_addr > flash_end_addr) {
return -1;
} else if (erase_end_addr < flash_end_addr){
uint32_t following_sector_size = flash_get_sector_size(&_flash, erase_end_addr);
if (!is_aligned(erase_end_addr, following_sector_size)) {
return -1;
}
}

int32_t ret = 0;
Expand All @@ -132,10 +168,6 @@ int FlashIAP::erase(uint32_t addr, uint32_t size)
break;
}
current_sector_size = flash_get_sector_size(&_flash, addr);
if (!is_aligned_to_sector(addr, size)) {
ret = -1;
break;
}
size -= current_sector_size;
addr += current_sector_size;
}
Expand Down
5 changes: 3 additions & 2 deletions drivers/FlashIAP.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class FlashIAP : private NonCopyable<FlashIAP> {
* The sectors must have been erased prior to being programmed
*
* @param buffer Buffer of data to be written
* @param addr Address of a page to begin writing to, must be a multiple of program and sector sizes
* @param size Size to write in bytes, must be a multiple of program and sector sizes
* @param addr Address of a page to begin writing to
* @param size Size to write in bytes, must be a multiple of program size
* @return 0 on success, negative error code on failure
*/
int program(const void *buffer, uint32_t addr, uint32_t size);
Expand Down Expand Up @@ -128,6 +128,7 @@ class FlashIAP : private NonCopyable<FlashIAP> {
bool is_aligned_to_sector(uint32_t addr, uint32_t size);

flash_t _flash;
uint8_t *_page_buf;
static SingletonPtr<PlatformMutex> _mutex;
};

Expand Down
4 changes: 1 addition & 3 deletions features/FEATURE_LWIP/lwip-interface/lwip_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,7 @@ static bool lwip_ppp = false;

static nsapi_error_t mbed_set_dhcp(struct netif *lwip_netif)
{
if (!lwip_ppp) {
netif_set_up(lwip_netif);
}
netif_set_up(lwip_netif);

#if LWIP_DHCP
if (lwip_dhcp && lwip_dhcp_has_to_be_set) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,40 +103,37 @@ void mbedtls_sha1_clone(mbedtls_sha1_context *dst,
/*
* SHA-1 context setup
*/
int mbedtls_sha1_starts_ret(mbedtls_sha1_context *ctx)
void mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
{
if (ctx->active_ctx == &ctx->hw_ctx) {
mbedtls_sha1_hw_starts(&ctx->hw_ctx);
} else if (ctx->active_ctx == &ctx->sw_ctx) {
mbedtls_sha1_sw_starts(&ctx->sw_ctx);
}
return 0;
}

/*
* SHA-1 process buffer
*/
int mbedtls_sha1_update_ret(mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen)
void mbedtls_sha1_update(mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen)
{
if (ctx->active_ctx == &ctx->hw_ctx) {
mbedtls_sha1_hw_update(&ctx->hw_ctx, input, ilen);
} else if (ctx->active_ctx == &ctx->sw_ctx) {
mbedtls_sha1_sw_update(&ctx->sw_ctx, input, ilen);
}
return 0;
}

/*
* SHA-1 final digest
*/
int mbedtls_sha1_finish_ret(mbedtls_sha1_context *ctx, unsigned char output[20])
void mbedtls_sha1_finish(mbedtls_sha1_context *ctx, unsigned char output[20])
{
if (ctx->active_ctx == &ctx->hw_ctx) {
mbedtls_sha1_hw_finish(&ctx->hw_ctx, output);
} else if (ctx->active_ctx == &ctx->sw_ctx) {
mbedtls_sha1_sw_finish(&ctx->sw_ctx, output);
}
return 0;
}

void mbedtls_sha1_process(mbedtls_sha1_context *ctx, const unsigned char data[64])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,31 +66,25 @@ void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
* \brief SHA-1 context setup
*
* \param ctx context to be initialized
*
* \return 0 if successful
*/
int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx );
void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );

/**
* \brief SHA-1 process buffer
*
* \param ctx SHA-1 context
* \param input buffer holding the data
* \param ilen length of the input data
*
* \return 0 if successful
*/
int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen );
void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen );

/**
* \brief SHA-1 final digest
*
* \param ctx SHA-1 context
* \param output SHA-1 checksum result
*
* \return 0 if successful
*/
int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx, unsigned char output[20] );
void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, unsigned char output[20] );

/* Internal use */
void mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[64] );
Expand Down
Loading