Skip to content

contest: 2020: add a blinky application #61

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions arc_design_contest/2020/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This folder for FY20 contest.
89 changes: 89 additions & 0 deletions arc_design_contest/2020/blinky/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
.. _example_blinky:

Blinky
######

Overview
********

This example is designed to test board without any extra peripheral.

Detailed Description
====================
* Extra Required Tools
NO

* Extra Required Peripherals
NO

* Design Concept
This example is designed to test board without any extra peripheral

* Usage Manual
Toggle all leds on board in 1s period

* Extra Comments
NO

Buidling and Running
********************

This example outputs to the console. It is supported by all platform. The commands
to run this example are as follows:

.. code-block:: console

$ cd <embarc_root>/example/baremetal/blinky
$ make BOARD=emsk BD_VER=11 CUR_CORE=arcem6 TOOLCHAIN=gnu run

If you do not have an EMSK development board, you can use the nSIM simulator
which have been installed in MetaWare IDE.

.. code-block:: console

$ cd <embarc_root>/example/baremetal/blinky
$ gmake BOARD=nsim BD_VER=1506 CUR_CORE=arcemfull TOOLCHAIN=mw run

.. note:: Make sure you have selected the correct configuration of EMSK via dipswitches and that you have reset the board (button above “R”) to confirme its configuration

Sample Output
=============

If you are using the **nSIM**, one console msg wil be used to simulate the
bink of LEDs, you will see the following output in the CMD window when the
download is successful.

.. code-block:: console

Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\embarc_osp-master\example\baremetal\blinky>gmake BOARD=nsim TOOLCHAIN=mw -j4 run
"Creating Directory : " obj_nsim_1506/mw_arcemfull/application/.
"Creating Directory : " obj_nsim_1506/mw_arcemfull/arc
"Creating Directory : " obj_nsim_1506/mw_arcemfull/board
"Creating Directory : " obj_nsim_1506/mw_arcemfull/board/nsim/drivers/uart
"Creating Directory : " obj_nsim_1506/mw_arcemfull/library/clib
.........................
"Linking : " obj_nsim_1506/mw_arcemfull/blinky_mw_arcemfull.elf
"Download & Run obj_nsim_1506/mw_arcemfull/blinky_mw_arcemfull.elf"
mdb -nooptions -nogoifmain -toggle=include_local_symbols=1 -nsim -off=binary_stdin -off=binary_stdout -on=load_at_paddr -on=reset_upon_restart -off=flush_pipe -off=cr_for_more -OKN -arcv2em -core2 -Xtimer0 -Xtimer1 -Xlib -Xmpy_option=6 -Xdiv_rem=radix2 -Xcode_density -Xatomic -Xbitscan -Xbarrel_shifter -mpu -mpu_regions=16 -Xdsp2 -Xdsp_complex -Xdsp_divsqrt=radix2 -Xdsp_itu -Xdsp_accshift=full -Xagu_large -Xxy -Xbitstream -Xfpus_div -Xfpu_mac -Xfpus_mpy_slow -Xfpus_div_slow -firq -interrupts=8 -ext_interrupts=6 -interrupt_priorities=16 -icache_feature=2 -iccm_base=0x00000000 -iccm_size=0x00080000 -dcache_feature=2 -dccm_base=0x80000000 -dccm_size=0x00080000 -rgf_num_banks=2 -rgf_banked_regs=32 -pc_width=32 -dmac -dmac_channels=2 -dmac_registers=0 -dmac_fifo_depth=2 -dmac_int_config=single_internal -run obj_nsim_1506/mw_arcemfull/blinky_mw_arcemfull.elf
led out: ff, ff
led out: ff00, ff
led out: ff, ff
led out: ff00, ff
led out: ff, ff
led out: ff00, ff
led out: ff, ff
led out: ff00, ff
led out: ff, ff
led out: ff00, ff
led out: ff, ff
led out: ff00, ff
led out: ff, ff
led out: ff00, ff
led out: ff, ff
.................

If you are using the **ARC EMSK** development board, you will see the leds
start to blink when the download is successful.
49 changes: 49 additions & 0 deletions arc_design_contest/2020/blinky/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* ------------------------------------------
* 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 written 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 LED_TOGGLE_MASK BOARD_LED_MASK

/**
* \brief Test hardware board without any peripheral
*/
int main(void)
{
uint16_t led_toggle_val = LED_TOGGLE_MASK;

while (1) {
led_write(led_toggle_val, BOARD_LED_MASK);
led_toggle_val = ~led_toggle_val;
board_delay_ms(500, 1);
}

return E_SYS;
}
23 changes: 23 additions & 0 deletions arc_design_contest/2020/blinky/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Application name
APPL ?= blinky

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

MID_SEL = common

# 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