loader.c

来自「Hermit-at-1.1.3,一款bootloader」· C语言 代码 · 共 69 行

C
69
字号
/* * Copyright (c) 2003 Atmark Techno, Inc.  All Rights Reserved. */#include <target/buffer.h>#include <target/crc.h>#include <target/io.h>#include <target/frob.h>#include <target/flash.h>#include "memmap.h"#include "linux.h"#include "mode.h"char *target_profile = TARGET_PROFILE;static const command_t *commands[] = {	&help_command,	&frob_command,	&jump_command,	&upload_command,	&version_command,        &memmap_command,        &flash_erase_command,        &flash_program_command,	&download_command,        &linux_command,        &boot_command,	0};ABBR(help_command, '?')ABBR(frob_command, 'f')ABBR(version_command, 'V')ABBR(boot_command, 'b')static const abbrev_t *abbrevs[] = {	&help_command_abbrev,	&frob_command_abbrev,	&version_command_abbrev,	&boot_command_abbrev,	0};/* turn on red led */static void turn_on_red_led(void){	write32(XPAR_OPB_GPIO_LED_BASEADDR, 0x0);}int hmain(void){	command_list_t command_list = { commands, abbrevs, "hermit", 0 };	turn_on_red_led();	flash_initialize((is_flash_spi() ? FLASH_TYPE_SPI : FLASH_TYPE_AMD),			 FLASH_BASEADDR);        if (is_autoboot())                (*boot_command.func)(0, 0);	/* startup stuff: print version string */	(*version_command.func)(0, 0);	init_crc32();	do_command_loop(&command_list);	for (;;);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?