OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /neorv32/trunk/sw/example/blink_led
    from Rev 21 to Rev 22
    Reverse comparison

Rev 21 → Rev 22

/main.c
52,40 → 52,37
 
 
/**********************************************************************//**
* Main function, shows an incrementing 8-bit timer on GPIO.output(7:0).
* Main function; shows an incrementing 8-bit counter on GPIO.output(7:0).
*
* @note This program requires the GPIO to be synthesized (the UART is optional).
* @note This program requires the GPIO controller to be synthesized (the UART is optional).
*
* @return Irrelevant.
**************************************************************************/
int main() {
 
// init UART at default baud rate, no rx interrupt, no tx interrupt
neorv32_uart_setup(BAUD_RATE, 0, 0);
 
// check if GPIO unit is implemented at all
if (neorv32_gpio_available() == 0) {
return 0; // nope, no GPIO unit synthesized :(
neorv32_uart_print("Error! No GPIO unit synthesized!\n");
return 0; // nope, no GPIO unit synthesized
}
 
 
// capture all exceptions and give debug info via UART
// this is not required, but keeps us safe
neorv32_rte_setup();
 
 
// init UART at default baud rate, no rx interrupt, no tx interrupt
neorv32_uart_setup(BAUD_RATE, 0, 0);
 
// say hello
neorv32_uart_print("Blinking LED demo program\n");
 
 
neorv32_gpio_port_set(0); // clear gpio output put
 
int cnt = 0;
 
while (1) {
neorv32_gpio_port_set(cnt & 0xFF); // mask for lowest 8 bit
neorv32_cpu_delay_ms(200); // wait 0.2s using busy wait
cnt++; // increment counter
neorv32_gpio_port_set(cnt++ & 0xFF); // increment counter and mask for lowest 8 bit
neorv32_cpu_delay_ms(200); // wait 200ms using busy wait
}
 
return 0;
/makefile
86,7 → 86,7
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# Default linker script
# Linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
141,9 → 141,8
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
# Use different base address and legth for instruction memory/"rom" (BOOTMEM instead of IMEM)
target bootloader: CC_OPTS += -Wl,--defsym=make_bootloader=1
 
 
# -----------------------------------------------------------------------------
262,7 → 261,6
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.