tests: boards: add SysID test app for altera_max10 board

Add test application to demonstrate the usage of Nios-II
System ID soft IP.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit is contained in:
Ramakrishna Pallala 2017-12-12 20:09:23 -05:00 committed by Anas Nashif
parent 27aced168d
commit eace9ede03
5 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,5 @@
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -0,0 +1,2 @@
Build test for:
Altera Nios-II System ID soft IP core.

View file

@ -0,0 +1,2 @@
CONFIG_ALTERA_AVALON_SYSID=y
CONFIG_ZTEST=y

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2017 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <ztest.h>
#include "altera_avalon_sysid.h"
void testing_sysid(void)
{
s32_t sysid, status = TC_FAIL;
sysid = alt_avalon_sysid_test();
if (!sysid) {
status = TC_PASS;
TC_PRINT("[SysID] hardware and software appear to be in sync\n");
} else if (sysid > 0) {
TC_PRINT("[SysID] software appears to be older than hardware\n");
} else {
TC_PRINT("[SysID] hardware appears to be older than software\n");
}
zassert_equal(status, TC_PASS, "SysID test failed");
}
void test_main(void)
{
ztest_test_suite(nios2_sysid_test_suite,
ztest_unit_test(testing_sysid));
ztest_run_test_suite(nios2_sysid_test_suite);
}

View file

@ -0,0 +1,4 @@
tests:
test:
platform_whitelist: altera_max10
tags: sysid