28a893b9b8cdf82b29bfbe432a3e547a385d9978
1 // This file is Copyright (c) 2013-2014 Sebastien Bourdeauducq <sb@m-labs.hk>
2 // This file is Copyright (c) 2014-2019 Florent Kermarrec <florent@enjoy-digital.fr>
3 // This file is Copyright (c) 2015 Yann Sionneau <ys@m-labs.hk>
4 // This file is Copyright (c) 2015 whitequark <whitequark@whitequark.org>
5 // This file is Copyright (c) 2019 Ambroz Bizjak <ambrop7@gmail.com>
6 // This file is Copyright (c) 2019 Caleb Jamison <cbjamo@gmail.com>
7 // This file is Copyright (c) 2018 Dolu1990 <charles.papon.90@gmail.com>
8 // This file is Copyright (c) 2018 Felix Held <felix-github@felixheld.de>
9 // This file is Copyright (c) 2019 Gabriel L. Somlo <gsomlo@gmail.com>
10 // This file is Copyright (c) 2018 Jean-François Nguyen <jf@lambdaconcept.fr>
11 // This file is Copyright (c) 2018 Sergiusz Bazanski <q3k@q3k.org>
12 // This file is Copyright (c) 2016 Tim 'mithro' Ansell <mithro@mithis.com>
13 // This file is Copyright (c) 2020 Franck Jullien <franck.jullien@gmail.com>
14 // This file is Copyright (c) 2020 Antmicro <www.antmicro.com>
33 #include <generated/csr.h>
34 #include <generated/soc.h>
35 #include <generated/mem.h>
36 #include <generated/git.h>
40 #include <liblitedram/sdram.h>
42 #include <libliteeth/udp.h>
43 #include <libliteeth/mdio.h>
45 #include <liblitespi/spiflash.h>
47 #include <liblitesdcard/sdcard.h>
49 static void boot_sequence(void)
52 #ifdef FLASH_BOOT_ADDRESS
55 #ifdef ROM_BOOT_ADDRESS
58 #if defined(CSR_SPISDCARD_BASE) || defined(CSR_SDCORE_BASE)
61 #ifdef CSR_ETHMAC_BASE
62 #ifdef CSR_ETHPHY_MODE_DETECTION_MODE_ADDR
67 printf("No boot medium found\n");
71 int main(int i
, char **c
)
73 char buffer
[CMD_LINE_BUFFER_SIZE
];
74 char *params
[MAX_PARAM
];
76 struct command_struct
*cmd
;
80 #ifdef CONFIG_CPU_HAS_INTERRUPT
87 printf("\e[1m __ _ __ _ __\e[0m\n");
88 printf("\e[1m / / (_) /____ | |/_/\e[0m\n");
89 printf("\e[1m / /__/ / __/ -_)> <\e[0m\n");
90 printf("\e[1m /____/_/\\__/\\__/_/|_|\e[0m\n");
91 printf("\e[1m Build your hardware, easily!\e[0m\n");
93 printf(" (c) Copyright 2012-2020 Enjoy-Digital\n");
94 printf(" (c) Copyright 2007-2015 M-Labs\n");
96 printf(" BIOS built on "__DATE__
" "__TIME__
"\n");
99 printf(" Migen git sha1: "MIGEN_GIT_SHA1
"\n");
100 printf(" LiteX git sha1: "LITEX_GIT_SHA1
"\n");
102 printf("--=============== \e[1mSoC\e[0m ==================--\n");
103 printf("\e[1mCPU\e[0m:\t\t%s @ %dMHz\n",
104 CONFIG_CPU_HUMAN_NAME
,
105 CONFIG_CLOCK_FREQUENCY
/1000000);
106 printf("\e[1mBUS\e[0m:\t\t%s %d-bit @ %dGiB\n",
108 CONFIG_BUS_DATA_WIDTH
,
109 (1 << (CONFIG_BUS_ADDRESS_WIDTH
- 30)));
110 printf("\e[1mCSR\e[0m:\t\t%d-bit data\n",
111 CONFIG_CSR_DATA_WIDTH
);
112 printf("\e[1mROM\e[0m:\t\t%dKiB\n", ROM_SIZE
/1024);
113 printf("\e[1mSRAM\e[0m:\t\t%dKiB\n", SRAM_SIZE
/1024);
114 #ifdef CONFIG_L2_SIZE
115 printf("\e[1mL2\e[0m:\t\t%dKiB\n", CONFIG_L2_SIZE
/1024);
118 #ifdef CSR_SDRAM_BASE
119 printf("\e[1mSDRAM\e[0m:\t\t%dKiB %d-bit @ %dMHz\n",
124 printf("\e[1mMAIN-RAM\e[0m:\t%dKiB \n", MAIN_RAM_SIZE
/1024);
131 #if defined(CSR_ETHMAC_BASE) || defined(CSR_SDRAM_BASE)
132 printf("--========== \e[1mInitialization\e[0m ============--\n");
133 #ifdef CSR_ETHMAC_BASE
136 #ifdef CSR_SDRAM_BASE
144 printf("Memory initialization failed\n");
147 #ifdef CSR_SPIFLASH_MMAP_BASE
152 printf("--============== \e[1mBoot\e[0m ==================--\n");
157 printf("--============= \e[1mConsole\e[0m ================--\n");
158 #if !defined(TERM_MINI) && !defined(TERM_NO_HIST)
161 printf("\n%s", PROMPT
);
163 readline(buffer
, CMD_LINE_BUFFER_SIZE
);
164 if (buffer
[0] != 0) {
166 nb_params
= get_param(buffer
, &command
, params
);
167 cmd
= command_dispatcher(command
, nb_params
, params
);
169 printf("Command not found");
171 printf("\n%s", PROMPT
);