Source code for the Trusted Boot Module.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
tbm-mcu/source/main.c

53 lines
933 B

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <console.h>
#include <gpio.h>
#include <rcc.h>
#include <shell.h>
#include <libopencm3/stm32/usart.h>
struct usart_console *user_con, *admin_con;
struct shell user_shell, admin_shell;
static void do_echo(FILE *out, const char **argv, size_t argc)
{
if (argc < 1)
return;
fprintf(out, "%s\n", argv[0]);
}
struct cmd cmds[] = {
{ "echo", "", do_echo },
{ NULL, NULL, NULL },
};
int main(void)
{
FILE *fp;
rcc_init();
gpio_init();
user_con = console_init(0);
admin_con = console_init(1);
fp = console_to_fp(user_con);
fprintf(fp, "TBM-dev (built on " __DATE__ ")\n");
fp = console_to_fp(admin_con);
fprintf(fp, "TBM-dev (built on " __DATE__ ")\n");
shell_init(&user_shell, cmds, user_con, "tbm $");
shell_init(&admin_shell, cmds, admin_con, "tbm #");
while (1) {
shell_parse(&user_shell);
shell_parse(&admin_shell);
}
return 0;
}