Skip to content

Commit

Permalink
Merge pull request #79 from foss-for-synopsys-dwc-arc-processors/feat…
Browse files Browse the repository at this point in the history
…ure/2018_12_rc2_fix

Feature/2018 12 rc2 fix
  • Loading branch information
Wayne Ren authored Jan 24, 2019
2 parents c63986f + f10541b commit f3879e6
Show file tree
Hide file tree
Showing 27 changed files with 1,110 additions and 62 deletions.
13 changes: 6 additions & 7 deletions board/linker_template_gnu.ld
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,22 @@ SECTIONS
_f_sdata = .;
__SDATA_BEGIN__ = .;
*(.sdata .sdata.* .gnu.linkonce.s.*)
_e_sdata = .;
_e_data = .;
} > REGION_RAM AT > REGION_ROM

.bss (NOLOAD) : ALIGN(8)
{
PROVIDE (__sbss_start = .);
PROVIDE (___sbss_start = .);
_f_bss = .;
_f_sbss = .;
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
_e_sbss = .;
PROVIDE (__sbss_end = .);
PROVIDE (___sbss_end = .);
_e_sdata = .;
_e_data = .;
} > REGION_RAM AT > REGION_ROM

.bss (NOLOAD) : ALIGN(8)
{
_f_bss = .;
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
Expand Down
1 change: 1 addition & 0 deletions board/linker_template_mw.ld
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ SECTIONS {
_f_data = .;
_f_sdata = .;
*(.sdata)
*(.sbss)
_e_sdata = .;
*(TYPE data)
}
Expand Down
5 changes: 3 additions & 2 deletions example/baremetal/openthread/cli/mbedtls-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <openthread/config.h>
#include <openthread/platform/logging.h>
#include <openthread/platform/memory.h>
#include <stdio.h>

#if defined(_WIN32)
#include <stdarg.h>
Expand Down Expand Up @@ -189,7 +190,7 @@ __inline int windows_kernel_snprintf(char * s, size_t n, const char * format, ..
//#define MBEDTLS_PLATFORM_TIME_ALT
//#define MBEDTLS_PLATFORM_FPRINTF_ALT
//#define MBEDTLS_PLATFORM_PRINTF_ALT
//#define MBEDTLS_PLATFORM_SNPRINTF_ALT
#define MBEDTLS_PLATFORM_SNPRINTF_ALT
//#define MBEDTLS_PLATFORM_NV_SEED_ALT

/**
Expand Down Expand Up @@ -2557,7 +2558,7 @@ __inline int windows_kernel_snprintf(char * s, size_t n, const char * format, ..
//#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */
/* Note: your snprintf must correclty zero-terminate the buffer! */
//#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
Expand Down
5 changes: 3 additions & 2 deletions example/baremetal/openthread/ncp/mbedtls-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <openthread/config.h>
#include <openthread/platform/logging.h>
#include <openthread/platform/memory.h>
#include <stdio.h>

#if defined(_WIN32)
#include <stdarg.h>
Expand Down Expand Up @@ -189,7 +190,7 @@ __inline int windows_kernel_snprintf(char * s, size_t n, const char * format, ..
//#define MBEDTLS_PLATFORM_TIME_ALT
//#define MBEDTLS_PLATFORM_FPRINTF_ALT
//#define MBEDTLS_PLATFORM_PRINTF_ALT
//#define MBEDTLS_PLATFORM_SNPRINTF_ALT
#define MBEDTLS_PLATFORM_SNPRINTF_ALT
//#define MBEDTLS_PLATFORM_NV_SEED_ALT

/**
Expand Down Expand Up @@ -2557,7 +2558,7 @@ __inline int windows_kernel_snprintf(char * s, size_t n, const char * format, ..
//#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */
/* Note: your snprintf must correclty zero-terminate the buffer! */
//#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
Expand Down
2 changes: 1 addition & 1 deletion example/baremetal/secureshield/secret_normal/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ For nSIM, the commands to run this example are as follows:
.. code-block:: console
$ cd <embarc_root>/example/baremetal/secureshield/secret_normal
$ gmake BOARD=nsim BD_VER=1506 CUR_CORE=arcemsecureshield TOOLCHAIN=mw run
$ gmake BOARD=nsim BD_VER=10 CUR_CORE=arcsem TOOLCHAIN=mw run
For EMSK 2.2, the commands to run this example are as follows:

Expand Down
4 changes: 3 additions & 1 deletion example/baremetal/secureshield/secret_normal/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ BOARD ?= nsim

CUR_CORE ?= arcsem

APPL_DEFINES = -DLIB_SECURESHIELD_OVERRIDES -DNTSHELL_USE_CMDS_PERIPHERAL=0 -DNTSHELL_USE_CMDS_ARC=0
# secureshield doesn't support stack check now
APPL_DEFINES = -DLIB_SECURESHIELD_OVERRIDES -DNTSHELL_USE_CMDS_PERIPHERAL=0\
-DNTSHELL_USE_CMDS_ARC=0 -DARC_FEATURE_STACK_CHECK=0

#
# root dir of embARC
Expand Down
2 changes: 1 addition & 1 deletion example/baremetal/secureshield/secret_secure/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ For nSIM, the commands to run this example are as follows:
.. code-block:: console
$ cd <embarc_root>/example/baremetal/secureshield/secret_secure
$ gmake BOARD=nsim BD_VER=1506 CUR_CORE=arcemsecureshield TOOLCHAIN=mw run
$ gmake BOARD=nsim BD_VER=10 CUR_CORE=arcsem TOOLCHAIN=mw run
For EMSK 2.2, the commands to run this example are as follows:

Expand Down
4 changes: 3 additions & 1 deletion example/baremetal/secureshield/secret_secure/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ BOARD ?= nsim

CUR_CORE ?= arcsem

APPL_DEFINES = -DLIB_SECURESHIELD_OVERRIDES -DNTSHELL_USE_CMDS_PERIPHERAL=0 -DNTSHELL_USE_CMDS_ARC=0
# secureshield doesn't support stack check now
APPL_DEFINES = -DLIB_SECURESHIELD_OVERRIDES -DNTSHELL_USE_CMDS_PERIPHERAL=0\
-DNTSHELL_USE_CMDS_ARC=0 -DARC_FEATURE_STACK_CHECK=0

#
# root dir of embARC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For nSIM, the commands to run this example are as follows:
.. code-block:: console
$ cd <embarc_root>/example/baremetal/secureshield/secret_secure_sid
$ gmake BOARD=nsim BD_VER=1506 CUR_CORE=arcemsecureshield TOOLCHAIN=mw run
$ gmake BOARD=nsim BD_VER=10 CUR_CORE=arcsem TOOLCHAIN=mw run
For EMSK 2.3, the commands to run this example are as follows:

Expand Down
4 changes: 3 additions & 1 deletion example/baremetal/secureshield/secret_secure_sid/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ BOARD ?= nsim

CUR_CORE = arcsem

APPL_DEFINES = -DNTSHELL_USE_CMDS_PERIPHERAL=0 -DNTSHELL_USE_CMDS_ARC=0
# secureshield doesn't support stack check now
APPL_DEFINES = -DNTSHELL_USE_CMDS_PERIPHERAL=0 -DNTSHELL_USE_CMDS_ARC=0\
-DARC_FEATURE_STACK_CHECK=0

#
# root dir of embARC
Expand Down
2 changes: 1 addition & 1 deletion example/baremetal/secureshield/test_case/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ It is supported by nSIM. The commands to run this example are as follows:
.. code-block:: console
$ cd <embarc_root>/example/baremetal/secureshield/test_case
$ gmake BOARD=nsim BD_VER=1506 CUR_CORE=arcemsecureshield TOOLCHAIN=mw run
$ gmake BOARD=nsim BD_VER=10 CUR_CORE=arcsem TOOLCHAIN=mw run
Sample Output
=============
Expand Down
4 changes: 3 additions & 1 deletion example/baremetal/secureshield/test_case/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ BOARD ?= nsim

CUR_CORE ?= arcsem

APPL_DEFINES = -DLIB_SECURESHIELD_OVERRIDES -DNTSHELL_USE_CMDS_PERIPHERAL=0 -DNTSHELL_USE_CMDS_ARC=0
# secureshield doesn't support stack check now
APPL_DEFINES = -DLIB_SECURESHIELD_OVERRIDES -DNTSHELL_USE_CMDS_PERIPHERAL=0\
-DNTSHELL_USE_CMDS_ARC=0 -DARC_FEATURE_STACK_CHECK=0

#
# root dir of embARC
Expand Down
103 changes: 103 additions & 0 deletions example/fatfs_test/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/* ------------------------------------------
* Copyright (c) 2017, Synopsys, Inc. All rights reserved.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1) Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
* 3) Neither the name of the Synopsys, Inc., nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior done permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
--------------------------------------------- */
#include "embARC.h"
#include "embARC_debug.h"

#define DATA_SIZE 8192
static FIL file;

uint8_t data_write[DATA_SIZE];
uint8_t data_read[DATA_SIZE];


/**
* \brief Test hardware board without any peripheral
*/
int main(void)
{
uint8_t res;
uint32_t i;
uint32_t rw_counter;
uint32_t done;
uint8_t *buf;

EMBARC_PRINTF("test start\r\n");

for (i = 0; i < DATA_SIZE; i++) {
data_write[i] = 'a' + i % 26;
}

res = f_open(&file, "test1.txt", FA_WRITE | FA_CREATE_ALWAYS);

if (res) {
EMBARC_PRINTF("file open err\r\n");
while (1);
}

rw_counter = DATA_SIZE;
buf = data_write;

while (rw_counter) {
res = f_write(&file, buf, rw_counter, &done);

if (res) {
EMBARC_PRINTF("file write error :%d\r\n", res);
while (1);
}
rw_counter -= done;
buf += done;
EMBARC_PRINTF("%d bytes are written\r\n", done);
}
f_close(&file);

res = f_open(&file, "test1.txt", FA_READ | FA_OPEN_EXISTING);

if (res) {
EMBARC_PRINTF("file open err\r\n");
while (1);
}

rw_counter = DATA_SIZE;
buf = data_read;

while (rw_counter) {
res = f_read(&file, buf, rw_counter, &done);

if (res) {
EMBARC_PRINTF("file read error :%d\r\n", res);
while (1);
}
rw_counter -= done;
buf += done;
EMBARC_PRINTF("%d bytes are read\r\n", done);
}

while (1);
}
24 changes: 24 additions & 0 deletions example/fatfs_test/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Application name
APPL ?= fatfs_test

BOARD = iotdk
#
# root dir of embARC
#
EMBARC_ROOT = ../..

MID_SEL = common fatfs

# application source dirs
APPL_CSRC_DIR = .
APPL_ASMSRC_DIR = .

# application include dirs
APPL_INC_DIR = .

# include current project makefile
COMMON_COMPILE_PREREQUISITES += makefile

### Options above must be added before include options.mk ###
# include key embARC build system makefile
include $(EMBARC_ROOT)/options/options.mk
11 changes: 10 additions & 1 deletion example/freertos/kernel_secure/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,21 @@ Detailed Description
- Re-configure the EMSK 2.3 board to EM7D configuration.
- run the following commands

For nSIM, the commands to run this example are as follows:

.. code-block:: console
$ cd <embarc_root>/example/freertos/kernel_secure
$ gmake BOARD=nsim BD_VER=10 CUR_CORE=arcsem TOOLCHAIN=mw run
For EMSK 2.3, the commands to run this example are as follows:

.. code-block:: console
$ cd <embarc_root>/example/freertos/kernel_secure
$ make BOARD=emsk BD_VER=23 CUR_CORE=arcem7d TOOLCHAIN=gnu run
.. note:: This example is only valid for arc processors with SecureShield feature (Currently, emsk 2.3 arcem7d)
.. note:: This example is only valid for arc processors with SecureShield feature (Currently, emsk 2.3 arcem7d and nsim arcsem)


Sample Output
Expand Down
3 changes: 3 additions & 0 deletions example/freertos/kernel_secure/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ EMBARC_ROOT = ../../..
LIB_SEL = secureshield
MID_SEL = common

# secureshield doesn't support stack check now
APPL_DEFINES = -DARC_FEATURE_STACK_CHECK=0

# application source dirs
APPL_CSRC_DIR = .
APPL_ASMSRC_DIR = .
Expand Down
Loading

0 comments on commit f3879e6

Please sign in to comment.