mirror of
				https://github.com/FreeRTOS/FreeRTOS-Kernel.git
				synced 2025-10-26 23:36:32 -04:00 
			
		
		
		
	* Add Makefile project for RISC-V QEMU virtpc
This patch adds simple demo directory for QEMU virtpc machine.
A demo just prints Tx/Rx message of queue to serial port, use no
other hardware and use only primary core (currently hart0).
Other cores are simply going to wfi state and execute nothing else.
Example command is:
  qemu-system-riscv32 -nographic -machine virt -net none \
    -chardev stdio,id=con,mux=on -serial chardev:con \
    -mon chardev=con,mode=readline -bios none \
    -kernel demo.elf -smp cpus=2 -s
* Fix copyright and URLS of FreeRTOS
* Fix Makefile
* Add Readme.md
* Separate blinky demo from main code
Co-authored-by: alfred gedeon <alfred2g@hotmail.com>
Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
Co-authored-by: Carl Lundin <53273776+lundinc2@users.noreply.github.com>
		
	
			
		
			
				
	
	
		
			70 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
| CROSS   = riscv64-unknown-elf-
 | |
| CC      = $(CROSS)gcc
 | |
| OBJCOPY = $(CROSS)objcopy
 | |
| ARCH    = $(CROSS)ar
 | |
| 
 | |
| BUILD_DIR       = build
 | |
| RTOS_SOURCE_DIR = $(abspath ../../Source)
 | |
| DEMO_SOURCE_DIR = $(abspath ../Common/Minimal)
 | |
| 
 | |
| CPPFLAGS = \
 | |
| 	-D__riscv_float_abi_soft \
 | |
| 	-DportasmHANDLE_INTERRUPT=handle_trap \
 | |
| 	-I . -I ../Common/include \
 | |
| 	-I $(RTOS_SOURCE_DIR)/include \
 | |
| 	-I $(RTOS_SOURCE_DIR)/portable/GCC/RISC-V \
 | |
| 	-I $(RTOS_SOURCE_DIR)/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions
 | |
| CFLAGS  = -march=rv32ima -mabi=ilp32 -mcmodel=medany \
 | |
| 	-Wall \
 | |
| 	-fmessage-length=0 \
 | |
| 	-ffunction-sections \
 | |
| 	-fdata-sections \
 | |
| 	-fno-builtin-printf
 | |
| ASFLAGS = -march=rv32ima -mabi=ilp32 -mcmodel=medany
 | |
| LDFLAGS = -nostartfiles -Tfake_rom.lds \
 | |
| 	-Xlinker --gc-sections \
 | |
| 	-Xlinker --defsym=__stack_size=300
 | |
| 
 | |
| ifeq ($(DEBUG), 1)
 | |
|     CFLAGS += -Og -ggdb3
 | |
| else
 | |
|     CFLAGS += -O2
 | |
| endif
 | |
| 
 | |
| SRCS = main.c main_blinky.c riscv-virt.c ns16550.c \
 | |
| 	$(DEMO_SOURCE_DIR)/EventGroupsDemo.c \
 | |
| 	$(DEMO_SOURCE_DIR)/TaskNotify.c \
 | |
| 	$(DEMO_SOURCE_DIR)/TimerDemo.c \
 | |
| 	$(DEMO_SOURCE_DIR)/blocktim.c \
 | |
| 	$(DEMO_SOURCE_DIR)/dynamic.c \
 | |
| 	$(DEMO_SOURCE_DIR)/recmutex.c \
 | |
| 	$(RTOS_SOURCE_DIR)/event_groups.c \
 | |
| 	$(RTOS_SOURCE_DIR)/list.c \
 | |
| 	$(RTOS_SOURCE_DIR)/queue.c \
 | |
| 	$(RTOS_SOURCE_DIR)/stream_buffer.c \
 | |
| 	$(RTOS_SOURCE_DIR)/tasks.c \
 | |
| 	$(RTOS_SOURCE_DIR)/timers.c \
 | |
| 	$(RTOS_SOURCE_DIR)/portable/MemMang/heap_4.c \
 | |
| 	$(RTOS_SOURCE_DIR)/portable/GCC/RISC-V/port.c
 | |
| 
 | |
| ASMS = start.S \
 | |
| 	$(RTOS_SOURCE_DIR)/portable/GCC/RISC-V/portASM.S
 | |
| 
 | |
| OBJS = $(SRCS:%.c=$(BUILD_DIR)/%.o) $(ASMS:%.S=$(BUILD_DIR)/%.o)
 | |
| DEPS = $(SRCS:%.c=$(BUILD_DIR)/%.d) $(ASMS:%.S=$(BUILD_DIR)/%.d)
 | |
| 
 | |
| $(BUILD_DIR)/RTOSDemo.axf: $(OBJS) fake_rom.lds Makefile
 | |
| 	$(CC) $(LDFLAGS) $(OBJS) -o $@
 | |
| 
 | |
| $(BUILD_DIR)/%.o: %.c Makefile
 | |
| 	@mkdir -p $(@D)
 | |
| 	$(CC) $(CPPFLAGS) $(CFLAGS) -MMD -MP -c $< -o $@
 | |
| 
 | |
| $(BUILD_DIR)/%.o: %.S Makefile
 | |
| 	@mkdir -p $(@D)
 | |
| 	$(CC) $(CPPFLAGS) $(ASFLAGS) -MMD -MP -c $< -o $@
 | |
| 
 | |
| clean:
 | |
| 	rm -rf $(BUILD_DIR)
 | |
| 
 | |
| -include $(DEPS)
 |