Skip to content

Commit

Permalink
hopefully fixed CI by building qemu ourselves
Browse files Browse the repository at this point in the history
Co-authored-by: Victor Roest <[email protected]>
  • Loading branch information
jdonszelmann and Victor Roest committed Mar 9, 2020
1 parent 82c027e commit d568c7b
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 22 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/os_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,26 @@ jobs:
path: toolchain
key: toolchain

- name: Cache Qemu
id: cache-qemu
uses: actions/cache@v1
with:
path: toolchain
key: toolchain

- name: Install Dependencies
run: |
sudo apt-get update &&
sudo apt-get install build-essential qemu-system-arm python3 wget texinfo zlib1g-dev -y
- name: Install Toolchain
- name: Build Toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: rm -rf toolchain/arm-none-eabi/ && make toolchain

- name: Build Qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: rm -rf qemu/qemu* && make qemu

- name: Compile
run: make build

Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
all: toolchain kernel
all: requirements kernel

toolchain:
cd ./toolchain && ./build.sh
.PHONY: toolchain

qemu:
cd ./qemu && ./build.sh
.PHONY: qemu

requirements: toolchain qemu

libc:
$(MAKE) -C user/libc

Expand Down
4 changes: 1 addition & 3 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ TOOLCHAIN_DIR=toolchain
BARE_METAL_TUPLE=arm-none-eabi
BARE_METAL_TARGET:=$(BARE_METAL_TUPLE)

QEMU=qemu-system-arm

UBOOT_VERSION=2014.10
QEMU=./qemu/qemu/bin/qemu-system-arm

#CFLAGS = -mcpu=arm1136j-s
CFLAGS = -mcpu=arm1176jz-s
2 changes: 1 addition & 1 deletion kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ CC:=$(TOOLCHAIN_PATH)/$(BARE_METAL_TUPLE)-gcc
AS:=$(TOOLCHAIN_PATH)/$(BARE_METAL_TUPLE)-as
LD:=$(TOOLCHAIN_PATH)/$(BARE_METAL_TUPLE)-gcc
OBJCOPY:=$(TOOLCHAIN_PATH)/$(BARE_METAL_TUPLE)-objcopy
MKIMAGE:=$(CURDIR)/../u-boot/u-boot-$(UBOOT_VERSION)/tools/mkimage
GDB:=$(TOOLCHAIN_PATH)/$(BARE_METAL_TUPLE)-gdb
QEMU := $(CURDIR)/../${QEMU}

DIRS = $(shell find $(SOURCEDIR)/ -type d -print)
C_SOURCE_FILES := $(foreach dir,$(DIRS),$(wildcard $(dir)/*.c)) $(TEST_MAIN_FILE)
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/common/include/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ enum SemihostingSWI {

void SemihostingCall(enum SemihostingSWI mode);

void SemihostingOSExit(int code) __attribute__ ((noreturn));;
void SemihostingOSExit(uint8_t code) __attribute__ ((noreturn));;

typedef enum {
IRQ, // (this is bit 0x8 on the CPSR)
Expand Down
10 changes: 2 additions & 8 deletions kernel/src/common/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,8 @@ void __attribute__((always_inline)) inline SemihostingCall(enum SemihostingSWI m

/// Uses the ExtendedExit Semihosting call
/// ARM Docs: https://developer.arm.com/docs/100863/0200/semihosting-operations/sys_exit_extended-0x20
void __attribute__((always_inline)) inline SemihostingOSExit(int code) {
struct {
uint32_t field1;
uint32_t field2;
} parameters;

parameters.field1 = ApplicationExit;
parameters.field2 = code;
void __attribute__((always_inline)) inline SemihostingOSExit(uint8_t code) {
struct {uint32_t f1; uint32_t f2;} parameters = {ApplicationExit, code };

asm volatile (
"MOV r0, #0x20\n"
Expand Down
5 changes: 2 additions & 3 deletions kernel/src/common/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@ void start(uint32_t *p_bootargs) {
// After this point kmalloc and kfree can be used for dynamic memory management.
init_heap();


// Splash screen
splash();


// Turn on interrupts
enable_interrupt(BOTH);

// Call the chipset again to do post-interrupt-enable initialization
// Call the chipset again to do any initialization after enabling interrupts and the heap.
chipset.late_init();


Expand Down
4 changes: 2 additions & 2 deletions kernel/src/klibc/klibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
* panic() added
- Currrently states the panic and stalls the machine
*/
void panic() {
void inline panic() {
disable_interrupt(BOTH);
kprintf("Kernel panic!\n");
WARN("Kernel panic!\n");
kprintf("\n ) ( \n");
kprintf(" ( /( ( )\\ ) \n");
kprintf(" )\\()) ( ( ( )\\ (()/( ) ( \n");
Expand Down
4 changes: 2 additions & 2 deletions qemu/build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

QEMU_VERSION=2.4.1
QEMU_VERSION=4.2.0

qemu-system-arm --version || {
{

if [ ! -e qemu-${QEMU_VERSION}.tar.bz2 ]; then
wget http://wiki.qemu-project.org/download/qemu-${QEMU_VERSION}.tar.bz2
Expand Down

0 comments on commit d568c7b

Please sign in to comment.