Compare commits
1 Commits
boot-test
...
ec4e3ec36d
Author | SHA1 | Date | |
---|---|---|---|
ec4e3ec36d |
@ -8,7 +8,7 @@
|
|||||||
.globl _prog_start
|
.globl _prog_start
|
||||||
_prog_start:
|
_prog_start:
|
||||||
smp_pause(s1, s2)
|
smp_pause(s1, s2)
|
||||||
li sp, (PAYLOAD_DEST + 0xffff000)
|
li sp, (PAYLOAD_DEST + 0x7fff000)
|
||||||
call main
|
call main
|
||||||
smp_resume(s1, s2)
|
smp_resume(s1, s2)
|
||||||
csrr a0, mhartid
|
csrr a0, mhartid
|
||||||
|
@ -20,8 +20,7 @@ static volatile uint32_t * const uart = (void *)(UART_CTRL_ADDR);
|
|||||||
|
|
||||||
static inline void kputc(char c)
|
static inline void kputc(char c)
|
||||||
{
|
{
|
||||||
//volatile uint32_t *tx = ®32(uart, UART_REG_TXFIFO);
|
volatile uint32_t *tx = ®32(uart, UART_REG_TXFIFO);
|
||||||
volatile uint32_t *tx = (void *) 0x64003000; // Terminal (32 bit)
|
|
||||||
#ifdef __riscv_atomic
|
#ifdef __riscv_atomic
|
||||||
int32_t r;
|
int32_t r;
|
||||||
do {
|
do {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#define PAYLOAD_SIZE (16 << 11)
|
#define PAYLOAD_SIZE (16 << 11)
|
||||||
|
|
||||||
#define F_CLK 60000000UL
|
#define F_CLK 50000000UL
|
||||||
|
|
||||||
static volatile uint32_t * const spi = (void *)(SPI_CTRL_ADDR);
|
static volatile uint32_t * const spi = (void *)(SPI_CTRL_ADDR);
|
||||||
|
|
||||||
@ -160,8 +160,7 @@ static int copy(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
dputs("CMD18");
|
dputs("CMD18");
|
||||||
//~ kprintf("LOADING ");
|
kprintf("LOADING ");
|
||||||
kprintf("READ: ");
|
|
||||||
|
|
||||||
REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 20000000UL);
|
REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 20000000UL);
|
||||||
if (sd_cmd(0x52, 0, 0xE1) != 0x00) {
|
if (sd_cmd(0x52, 0, 0xE1) != 0x00) {
|
||||||
@ -173,18 +172,14 @@ static int copy(void)
|
|||||||
long n;
|
long n;
|
||||||
|
|
||||||
crc = 0;
|
crc = 0;
|
||||||
//~ n = 512;
|
n = 512;
|
||||||
n = 50;
|
|
||||||
while (sd_dummy() != 0xFE);
|
while (sd_dummy() != 0xFE);
|
||||||
do {
|
do {
|
||||||
uint8_t x = sd_dummy();
|
uint8_t x = sd_dummy();
|
||||||
kputc(x);
|
*p++ = x;
|
||||||
//~ *p++ = x;
|
crc = crc16_round(crc, x);
|
||||||
//~ crc = crc16_round(crc, x);
|
|
||||||
} while (--n > 0);
|
} while (--n > 0);
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
crc_exp = ((uint16_t)sd_dummy() << 8);
|
crc_exp = ((uint16_t)sd_dummy() << 8);
|
||||||
crc_exp |= sd_dummy();
|
crc_exp |= sd_dummy();
|
||||||
|
|
||||||
@ -207,60 +202,10 @@ static int copy(void)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// leave room for 2 MiB stack (SP = 8FFFF000)
|
|
||||||
#define RAMTEST_START (uint32_t*)(0x80000000)
|
|
||||||
#define RAMTEST_END (uint32_t*)(0x8FDFF000)
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
//REG32(uart, UART_REG_TXCTRL) = UART_TXEN;
|
REG32(uart, UART_REG_TXCTRL) = UART_TXEN;
|
||||||
|
|
||||||
//GPIO_REG(GPIO_INPUT_EN) = 0xFF;
|
|
||||||
GPIO_REG(GPIO_OUTPUT_EN) = 0xFF;
|
|
||||||
GPIO_REG(GPIO_OUTPUT_VAL) = 0xFF;
|
|
||||||
|
|
||||||
kprintf("\nFilling RAM from %lx to %lx...\n", RAMTEST_START, RAMTEST_END);
|
|
||||||
|
|
||||||
uint32_t counter = 0;
|
|
||||||
for(uint32_t* ram = RAMTEST_START; ram < RAMTEST_END; ++ram) {
|
|
||||||
*ram = counter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
kprintf("\rChecking RAM...\n");
|
|
||||||
|
|
||||||
counter = 0;
|
|
||||||
uint32_t correct = 0;
|
|
||||||
uint32_t wrong = 0;
|
|
||||||
for(uint32_t* ram = RAMTEST_START; ram < RAMTEST_END; ++ram) {
|
|
||||||
if(*ram != counter) {
|
|
||||||
kprintf("\rMismatch at %lx: read %x, expected %x\n", ram, *ram, counter);
|
|
||||||
++wrong;
|
|
||||||
} else {
|
|
||||||
++correct;
|
|
||||||
}
|
|
||||||
++counter;
|
|
||||||
}
|
|
||||||
kprintf("\rSummary: %x matches, %x mismatches.\n", correct, wrong);
|
|
||||||
|
|
||||||
kprintf("\nTrying to read from SD card...\n");
|
|
||||||
|
|
||||||
kputs("POWERON");
|
|
||||||
sd_poweron();
|
|
||||||
kprintf("sd_cmd0: %hx\n", sd_cmd0());
|
|
||||||
kprintf("sd_cmd8: %hx\n", sd_cmd8());
|
|
||||||
kprintf("sd_acmd41: %hx\n", sd_acmd41());
|
|
||||||
kprintf("sd_cmd58: %hx\n", sd_cmd58());
|
|
||||||
kprintf("sd_cmd16: %hx\n", sd_cmd16());
|
|
||||||
kprintf("\ncopy: %hx\n", copy());
|
|
||||||
|
|
||||||
while(1) {
|
|
||||||
//uint8_t dip_value = GPIO_REG(GPIO_INPUT_VAL) & 0b01111111;
|
|
||||||
//kprintf("dip value: %hx, ram value: %c\n", dip_value, ram[dip_value]);
|
|
||||||
|
|
||||||
GPIO_REG(GPIO_OUTPUT_VAL) ^= 0xFF;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
/*
|
|
||||||
kputs("INIT");
|
kputs("INIT");
|
||||||
sd_poweron();
|
sd_poweron();
|
||||||
if (sd_cmd0() ||
|
if (sd_cmd0() ||
|
||||||
@ -276,5 +221,5 @@ int main(void)
|
|||||||
kputs("BOOT");
|
kputs("BOOT");
|
||||||
|
|
||||||
__asm__ __volatile__ ("fence.i" : : : "memory");
|
__asm__ __volatile__ ("fence.i" : : : "memory");
|
||||||
return 0;*/
|
return 0;
|
||||||
}
|
}
|
||||||
|
Submodule rocket-chip updated: 6df42fc360...81d631a6a1
@ -21,7 +21,7 @@ class FreedomUML507Config extends Config(
|
|||||||
new WithoutTLMonitors ++
|
new WithoutTLMonitors ++
|
||||||
new WithJtagDTM ++
|
new WithJtagDTM ++
|
||||||
new WithNMemoryChannels(1) ++
|
new WithNMemoryChannels(1) ++
|
||||||
new WithNBigCores(1) ++
|
new WithNSmallLinuxCores(1) ++
|
||||||
new BaseConfig
|
new BaseConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user