Sample example built with gdbstub enabled. Two serials are used, one for normal output and another one that is used talk with gdb in the host machine. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
38 lines
491 B
C
38 lines
491 B
C
/*
|
|
* Copyright (c) 2020 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr.h>
|
|
#include <sys/printk.h>
|
|
|
|
#define STACKSIZE 512
|
|
|
|
static int test(void)
|
|
{
|
|
int a;
|
|
int b;
|
|
|
|
a = 10;
|
|
b = a * 2;
|
|
|
|
return a + b;
|
|
}
|
|
|
|
static void thread_entry(void *p1, void *p2, void *p3)
|
|
{
|
|
printk("Hello from user thread!\n");
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
int ret;
|
|
|
|
ret = test();
|
|
printk("%d\n", ret);
|
|
}
|
|
|
|
K_THREAD_DEFINE(thread, STACKSIZE, thread_entry, NULL, NULL, NULL,
|
|
7, K_USER, 0);
|