SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
main.c File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <config.h>
#include <log.h>
#include <timer.h>
#include <common.h>
#include <jmp.h>
#include <mmu.h>
#include <smalloc.h>
#include <sstdlib.h>
#include <string.h>
#include <cli.h>
#include <cli_shell.h>
#include <cli_termesc.h>
#include <image_loader.h>
#include "sys-dram.h"
#include "sys-rtc.h"
#include "sys-sdcard.h"
#include "sys-sid.h"
#include "sys-spi.h"
#include "fdt_wrapper.h"
#include "ff.h"
#include "libfdt.h"
#include "uart.h"
Include dependency graph for main.c:

Classes

struct  image_info_t
 
struct  IniEntry
 

Macros

#define CONFIG_KERNEL_FILENAME   "zImage"
 
#define CONFIG_DTB_FILENAME   "sunxi.dtb"
 
#define CONFIG_CONFIG_FILENAME   "config.txt"
 
#define CONFIG_SDMMC_SPEED_TEST_SIZE   1024
 
#define CONFIG_DTB_LOAD_ADDR   (0x41008000)
 
#define CONFIG_KERNEL_LOAD_ADDR   (0x41800000)
 
#define CONFIG_CONFIG_LOAD_ADDR   (0x40008000)
 
#define CONFIG_HEAP_BASE   (0x40800000)
 
#define CONFIG_HEAP_SIZE   (16 * 1024 * 1024)
 
#define CONFIG_DEFAULT_BOOTDELAY   5
 
#define FILENAME_MAX_LEN   64
 
#define MAX_SECTION_LEN   16
 
#define MAX_KEY_LEN   16
 
#define MAX_VALUE_LEN   512
 
#define CONFIG_MAX_ENTRY   3
 
#define CHUNK_SIZE   0x20000
 

Functions

static int fatfs_loadimage (char *filename, BYTE *dest)
 
static int load_sdcard (image_info_t *image)
 
static void trim (char *str)
 
static int parse_ini_data (const char *data, size_t size, IniEntry *entries, int max_entries)
 
static const char * find_entry_value (const IniEntry *entries, int entry_count, const char *section, const char *key)
 
static int update_bootargs_from_config (uint32_t dram_size)
 
static int abortboot_single_key (int bootdelay)
 
 msh_declare_command (bootargs)
 
 msh_define_help (bootargs, "get/set bootargs for kernel", "Usage: bootargs set \"bootargs\" - set new bootargs for zImage\n" " bootargs get - get current bootargs\n")
 
int cmd_bootargs (int argc, const char **argv)
 
 msh_declare_command (reload)
 
 msh_define_help (reload, "rescan TF Card and reload DTB, Kernel zImage", "Usage: reload\n")
 
int cmd_reload (int argc, const char **argv)
 
 msh_declare_command (print)
 
 msh_define_help (print, "print out env config", "Usage: print\n")
 
int cmd_print (int argc, const char **argv)
 
 msh_declare_command (boot)
 
 msh_define_help (boot, "boot to linux", "Usage: boot\n")
 
int cmd_boot (int argc, const char **argv)
 
int main (void)
 

Variables

IniEntry entries [CONFIG_MAX_ENTRY]
 
sunxi_serial_t uart_dbg
 
sunxi_spi_t sunxi_spi0
 
sdhci_t sdhci2
 
dram_para_t dram_para
 
image_info_t image
 
const msh_command_entry commands []
 

Macro Definition Documentation

◆ CHUNK_SIZE

#define CHUNK_SIZE   0x20000

◆ CONFIG_CONFIG_FILENAME

#define CONFIG_CONFIG_FILENAME   "config.txt"

◆ CONFIG_CONFIG_LOAD_ADDR

#define CONFIG_CONFIG_LOAD_ADDR   (0x40008000)

◆ CONFIG_DEFAULT_BOOTDELAY

#define CONFIG_DEFAULT_BOOTDELAY   5

◆ CONFIG_DTB_FILENAME

#define CONFIG_DTB_FILENAME   "sunxi.dtb"

◆ CONFIG_DTB_LOAD_ADDR

#define CONFIG_DTB_LOAD_ADDR   (0x41008000)

◆ CONFIG_HEAP_BASE

#define CONFIG_HEAP_BASE   (0x40800000)

◆ CONFIG_HEAP_SIZE

#define CONFIG_HEAP_SIZE   (16 * 1024 * 1024)

◆ CONFIG_KERNEL_FILENAME

#define CONFIG_KERNEL_FILENAME   "zImage"

◆ CONFIG_KERNEL_LOAD_ADDR

#define CONFIG_KERNEL_LOAD_ADDR   (0x41800000)

◆ CONFIG_MAX_ENTRY

#define CONFIG_MAX_ENTRY   3

◆ CONFIG_SDMMC_SPEED_TEST_SIZE

#define CONFIG_SDMMC_SPEED_TEST_SIZE   1024

◆ FILENAME_MAX_LEN

#define FILENAME_MAX_LEN   64

◆ MAX_KEY_LEN

#define MAX_KEY_LEN   16

◆ MAX_SECTION_LEN

#define MAX_SECTION_LEN   16

◆ MAX_VALUE_LEN

#define MAX_VALUE_LEN   512

Function Documentation

◆ abortboot_single_key()

static int abortboot_single_key ( int  bootdelay)
static

◆ cmd_boot()

int cmd_boot ( int  argc,
const char **  argv 
)

◆ cmd_bootargs()

int cmd_bootargs ( int  argc,
const char **  argv 
)

◆ cmd_print()

int cmd_print ( int  argc,
const char **  argv 
)

◆ cmd_reload()

int cmd_reload ( int  argc,
const char **  argv 
)

◆ fatfs_loadimage()

static int fatfs_loadimage ( char *  filename,
BYTE dest 
)
static

◆ find_entry_value()

static const char * find_entry_value ( const IniEntry entries,
int  entry_count,
const char *  section,
const char *  key 
)
static

◆ load_sdcard()

static int load_sdcard ( image_info_t image)
static

◆ main()

int main ( void  )

◆ msh_declare_command() [1/4]

msh_declare_command ( boot  )

◆ msh_declare_command() [2/4]

msh_declare_command ( bootargs  )

◆ msh_declare_command() [3/4]

msh_declare_command ( print  )

◆ msh_declare_command() [4/4]

msh_declare_command ( reload  )

◆ msh_define_help() [1/4]

msh_define_help ( boot  ,
"boot to linux"  ,
"Usage: boot\n"   
)

◆ msh_define_help() [2/4]

msh_define_help ( bootargs  ,
"get/set bootargs for kernel"  ,
"Usage: bootargs set \"bootargs\" - set new bootargs for zImage\n" " bootargs get - get current bootargs\n"   
)

◆ msh_define_help() [3/4]

msh_define_help ( print  ,
"print out env config"  ,
"Usage: print\n"   
)

◆ msh_define_help() [4/4]

msh_define_help ( reload  ,
"rescan TF Card and reload  DTB,
Kernel zImage"  ,
"Usage: reload\n"   
)

◆ parse_ini_data()

static int parse_ini_data ( const char *  data,
size_t  size,
IniEntry entries,
int  max_entries 
)
static

◆ trim()

static void trim ( char *  str)
static

◆ update_bootargs_from_config()

static int update_bootargs_from_config ( uint32_t  dram_size)
static

Variable Documentation

◆ commands

const msh_command_entry commands[]
Initial value:
= {
msh_define_command(bootargs),
}
#define msh_command_end
Definition cli.h:21
#define msh_define_command(name)
Definition cli.h:33

◆ dram_para

dram_para_t dram_para
extern

◆ entries

◆ image

image_info_t image

◆ sdhci2

sdhci_t sdhci2
extern

◆ sunxi_spi0

sunxi_spi_t sunxi_spi0
extern

◆ uart_dbg

sunxi_serial_t uart_dbg
extern