mirror of
https://github.com/lowRISC/ibex.git
synced 2025-06-28 01:12:02 -04:00
Remove FPGA example
Now ibex-demo-system is available the FPGA example in the Ibex repository has less use and risks causing confusion so remove it entirely.
This commit is contained in:
parent
b4ae5bbb30
commit
ac245b394f
10 changed files with 0 additions and 860 deletions
|
@ -1,60 +0,0 @@
|
|||
# Copyright lowRISC contributors.
|
||||
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Generate a baremetal application
|
||||
|
||||
PROGRAM ?= led
|
||||
PROGRAM_CFLAGS = -Wall -g -Os
|
||||
ARCH = rv32imc
|
||||
# ARCH = rv32im # to disable compressed instructions
|
||||
SRCS = $(PROGRAM).c
|
||||
|
||||
CC = riscv32-unknown-elf-gcc
|
||||
|
||||
CROSS_COMPILE = $(patsubst %-gcc,%-,$(CC))
|
||||
OBJCOPY ?= $(CROSS_COMPILE)objcopy
|
||||
OBJDUMP ?= $(CROSS_COMPILE)objdump
|
||||
|
||||
LINKER_SCRIPT ?= link.ld
|
||||
CRT ?= crt0.S
|
||||
CFLAGS ?= -march=$(ARCH) -mabi=ilp32 -static -mcmodel=medany \
|
||||
-fvisibility=hidden -nostdlib -nostartfiles $(PROGRAM_CFLAGS)
|
||||
|
||||
OBJS := ${SRCS:.c=.o} ${CRT:.S=.o}
|
||||
DEPS = $(OBJS:%.o=%.d)
|
||||
|
||||
OUTFILES = $(PROGRAM).elf $(PROGRAM).vmem $(PROGRAM).bin $(PROGRAM).dis
|
||||
|
||||
all: $(OUTFILES)
|
||||
|
||||
$(PROGRAM).elf: $(OBJS) $(LINKER_SCRIPT)
|
||||
$(CC) $(CFLAGS) -T $(LINKER_SCRIPT) $(OBJS) -o $@ $(LIBS)
|
||||
|
||||
%.dis: %.elf
|
||||
$(OBJDUMP) -SD $^ > $@
|
||||
|
||||
# Note: this target requires the srecord package to be installed.
|
||||
# XXX: This could be replaced by objcopy once
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=19921
|
||||
# is widely available.
|
||||
# XXX: Currently the start address 0x00000000 is hardcoded. It could/should be
|
||||
# read from the elf file, but is lost in the bin file.
|
||||
# Switching to objcopy will resolve that as well.
|
||||
%.vmem: %.bin
|
||||
srec_cat $^ -binary -offset 0x0000 -byte-swap 4 -o $@ -vmem
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -O binary $^ $@
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -MMD -c $(INCS) -o $@ $<
|
||||
|
||||
%.o: %.S
|
||||
$(CC) $(CFLAGS) -MMD -c $(INCS) -o $@ $<
|
||||
|
||||
clean:
|
||||
$(RM) -f *.o *.d
|
||||
|
||||
distclean: clean
|
||||
$(RM) -f $(OUTFILES)
|
|
@ -1,89 +0,0 @@
|
|||
.section .text
|
||||
|
||||
default_exc_handler:
|
||||
jal x0, default_exc_handler
|
||||
|
||||
reset_handler:
|
||||
/* set all registers to zero */
|
||||
mv x1, x0
|
||||
mv x2, x1
|
||||
mv x3, x1
|
||||
mv x4, x1
|
||||
mv x5, x1
|
||||
mv x6, x1
|
||||
mv x7, x1
|
||||
mv x8, x1
|
||||
mv x9, x1
|
||||
mv x10, x1
|
||||
mv x11, x1
|
||||
mv x12, x1
|
||||
mv x13, x1
|
||||
mv x14, x1
|
||||
mv x15, x1
|
||||
mv x16, x1
|
||||
mv x17, x1
|
||||
mv x18, x1
|
||||
mv x19, x1
|
||||
mv x20, x1
|
||||
mv x21, x1
|
||||
mv x22, x1
|
||||
mv x23, x1
|
||||
mv x24, x1
|
||||
mv x25, x1
|
||||
mv x26, x1
|
||||
mv x27, x1
|
||||
mv x28, x1
|
||||
mv x29, x1
|
||||
mv x30, x1
|
||||
mv x31, x1
|
||||
|
||||
/* stack initilization */
|
||||
la x2, _stack_start
|
||||
|
||||
_start:
|
||||
.global _start
|
||||
|
||||
/* clear BSS */
|
||||
la x26, _bss_start
|
||||
la x27, _bss_end
|
||||
|
||||
bge x26, x27, zero_loop_end
|
||||
|
||||
zero_loop:
|
||||
sw x0, 0(x26)
|
||||
addi x26, x26, 4
|
||||
ble x26, x27, zero_loop
|
||||
zero_loop_end:
|
||||
|
||||
|
||||
main_entry:
|
||||
/* jump to main program entry point (argc = argv = 0) */
|
||||
addi x10, x0, 0
|
||||
addi x11, x0, 0
|
||||
jal x1, main
|
||||
|
||||
/* =================================================== [ exceptions ] === */
|
||||
/* This section has to be down here, since we have to disable rvc for it */
|
||||
|
||||
.section .vectors, "ax"
|
||||
.option norvc;
|
||||
|
||||
// external interrupts are handled by the same callback
|
||||
// until compiler supports IRQ routines
|
||||
.org 0x00
|
||||
.rept 31
|
||||
nop
|
||||
.endr
|
||||
jal x0, default_exc_handler
|
||||
|
||||
// reset vector
|
||||
.org 0x80
|
||||
jal x0, reset_handler
|
||||
|
||||
// illegal instruction exception
|
||||
.org 0x84
|
||||
jal x0, default_exc_handler
|
||||
|
||||
// ecall handler
|
||||
.org 0x88
|
||||
jal x0, default_exc_handler
|
|
@ -1,47 +0,0 @@
|
|||
// Copyright lowRISC contributors.
|
||||
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include <stdint.h>
|
||||
#define CLK_FIXED_FREQ_HZ (50ULL * 1000 * 1000)
|
||||
|
||||
/**
|
||||
* Delay loop executing within 8 cycles on ibex
|
||||
*/
|
||||
static void delay_loop_ibex(unsigned long loops) {
|
||||
int out; /* only to notify compiler of modifications to |loops| */
|
||||
asm volatile(
|
||||
"1: nop \n" // 1 cycle
|
||||
" nop \n" // 1 cycle
|
||||
" nop \n" // 1 cycle
|
||||
" nop \n" // 1 cycle
|
||||
" addi %1, %1, -1 \n" // 1 cycle
|
||||
" bnez %1, 1b \n" // 3 cycles
|
||||
: "=&r" (out)
|
||||
: "0" (loops)
|
||||
);
|
||||
}
|
||||
|
||||
static int usleep_ibex(unsigned long usec) {
|
||||
unsigned long usec_cycles;
|
||||
usec_cycles = CLK_FIXED_FREQ_HZ * usec / 1000 / 1000 / 8;
|
||||
|
||||
delay_loop_ibex(usec_cycles);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int usleep(unsigned long usec) {
|
||||
return usleep_ibex(usec);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// The lowest four bits of the highest byte written to the memory region named
|
||||
// "stack" are connected to the LEDs of the board.
|
||||
volatile uint8_t *var = (volatile uint8_t *) 0x0000c010;
|
||||
*var = 0x0a;
|
||||
|
||||
while (1) {
|
||||
usleep(1000 * 1000); // 1000 ms
|
||||
*var = ~(*var);
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
OUTPUT_ARCH(riscv)
|
||||
|
||||
/* required to correctly link newlib */
|
||||
GROUP( -lc -lgloss -lgcc -lsupc++ )
|
||||
|
||||
SEARCH_DIR(.)
|
||||
__DYNAMIC = 0;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
rom : ORIGIN = 0x00000000, LENGTH = 0xC000 /* 48 kB */
|
||||
stack : ORIGIN = 0x0000C000, LENGTH = 0x4000 /* 16 kB */
|
||||
}
|
||||
|
||||
/* Stack information variables */
|
||||
_min_stack = 0x2000; /* 8K - minimum stack space to reserve */
|
||||
_stack_len = LENGTH(stack);
|
||||
_stack_start = ORIGIN(stack) + LENGTH(stack);
|
||||
|
||||
/* We have to align each sector to word boundaries as our current s19->slm
|
||||
* conversion scripts are not able to handle non-word aligned sections. */
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.vectors :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.vectors))
|
||||
} > rom
|
||||
|
||||
.text : {
|
||||
. = ALIGN(4);
|
||||
_stext = .;
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
_etext = .;
|
||||
__CTOR_LIST__ = .;
|
||||
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
|
||||
*(.ctors)
|
||||
LONG(0)
|
||||
__CTOR_END__ = .;
|
||||
__DTOR_LIST__ = .;
|
||||
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
|
||||
*(.dtors)
|
||||
LONG(0)
|
||||
__DTOR_END__ = .;
|
||||
*(.lit)
|
||||
*(.shdata)
|
||||
. = ALIGN(4);
|
||||
_endtext = .;
|
||||
} > rom
|
||||
|
||||
.rodata : {
|
||||
. = ALIGN(4);
|
||||
*(.rodata);
|
||||
*(.rodata.*)
|
||||
} > rom
|
||||
|
||||
.shbss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.shbss)
|
||||
} > rom
|
||||
|
||||
.data : {
|
||||
. = ALIGN(4);
|
||||
sdata = .;
|
||||
_sdata = .;
|
||||
*(.data);
|
||||
*(.data.*)
|
||||
edata = .;
|
||||
_edata = .;
|
||||
} > rom
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_bss_start = .;
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(COMMON)
|
||||
_bss_end = .;
|
||||
} > rom
|
||||
|
||||
/* ensure there is enough room for stack */
|
||||
.stack (NOLOAD): {
|
||||
. = ALIGN(4);
|
||||
. = . + _min_stack ;
|
||||
. = ALIGN(4);
|
||||
stack = . ;
|
||||
_stack = . ;
|
||||
} > stack
|
||||
|
||||
.stab 0 (NOLOAD) :
|
||||
{
|
||||
[ .stab ]
|
||||
}
|
||||
|
||||
.stabstr 0 (NOLOAD) :
|
||||
{
|
||||
[ .stabstr ]
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue