From 0bd322d7b7eb9866e57c8c016a52358c036504fe Mon Sep 17 00:00:00 2001 From: Nelson Ehling Date: Wed, 27 Mar 2024 12:57:39 +0100 Subject: [PATCH] edit makefile for copying image and config to sd card --- part15-tcpip-webserver/Makefile | 17 ++++++--- part15-tcpip-webserver/Makefile.gcc | 20 ---------- part15-tcpip-webserver/config.txt | 53 ++++++++++++++++++++++++++ part15-tcpip-webserver/kernel/kernel.c | 2 +- 4 files changed, 65 insertions(+), 27 deletions(-) delete mode 100644 part15-tcpip-webserver/Makefile.gcc create mode 100644 part15-tcpip-webserver/config.txt diff --git a/part15-tcpip-webserver/Makefile b/part15-tcpip-webserver/Makefile index 7c9e887..69d33d3 100644 --- a/part15-tcpip-webserver/Makefile +++ b/part15-tcpip-webserver/Makefile @@ -1,20 +1,25 @@ +BOOTMNT ?= /media/cvdeveloper/bootfs + CFILES = $(wildcard *.c lib/*.c kernel/*.c net/*.c tcpip/*.c) SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S) OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o) -LLVMPATH = /opt/homebrew/opt/llvm/bin -CLANGFLAGS = -Wall -O0 -ffreestanding -nostdlib -mcpu=cortex-a72+nosimd +GCCFLAGS = -Wall -O0 -ffreestanding -nostdlib -nostartfiles +GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin all: clean kernel8.img %.o: %.c - $(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@ + $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@ %.o: %.S - $(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@ + $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@ kernel8.img: $(OFILES) - $(LLVMPATH)/ld.lld -m aarch64elf -nostdlib $(OFILES) -T boot/link.ld -o kernel8.elf - $(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img + $(GCCPATH)/aarch64-none-elf-ld -nostdlib $(OFILES) -T boot/link.ld -o kernel8.elf + $(GCCPATH)/aarch64-none-elf-objcopy -O binary kernel8.elf kernel8.img + cp kernel8.img $(BOOTMNT)/kernel8.img + cp config.txt $(BOOTMNT)/ + sync clean: /bin/rm kernel8.elf */*.o *.img > /dev/null 2> /dev/null || true diff --git a/part15-tcpip-webserver/Makefile.gcc b/part15-tcpip-webserver/Makefile.gcc deleted file mode 100644 index cb4b843..0000000 --- a/part15-tcpip-webserver/Makefile.gcc +++ /dev/null @@ -1,20 +0,0 @@ -CFILES = $(wildcard *.c lib/*.c kernel/*.c net/*.c tcpip/*.c) -SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S) -OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o) -GCCFLAGS = -Wall -O0 -ffreestanding -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin - -all: clean kernel8.img - -%.o: %.c - $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@ - -%.o: %.S - $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@ - -kernel8.img: $(OFILES) - $(GCCPATH)/aarch64-none-elf-ld -nostdlib $(OFILES) -T boot/link.ld -o kernel8.elf - $(GCCPATH)/aarch64-none-elf-objcopy -O binary kernel8.elf kernel8.img - -clean: - /bin/rm kernel8.elf */*.o *.img > /dev/null 2> /dev/null || true diff --git a/part15-tcpip-webserver/config.txt b/part15-tcpip-webserver/config.txt new file mode 100644 index 0000000..41944de --- /dev/null +++ b/part15-tcpip-webserver/config.txt @@ -0,0 +1,53 @@ +# For more options and information see +# http://rptl.io/configtxt +# Some settings may impact device functionality. See link above for details + +# Uncomment some or all of these to enable the optional hardware interfaces +#dtparam=i2c_arm=on +#dtparam=i2s=on +#dtparam=spi=on + +# Enable audio (loads snd_bcm2835) +dtparam=audio=on + +# Additional overlays and parameters are documented +# /boot/firmware/overlays/README + +# Automatically load overlays for detected cameras +camera_auto_detect=1 + +# Automatically load overlays for detected DSI displays +display_auto_detect=1 + +# Automatically load initramfs files, if found +auto_initramfs=1 + +# Enable DRM VC4 V3D driver +dtoverlay=vc4-kms-v3d +max_framebuffers=2 + +# Don't have the firmware create an initial video= setting in cmdline.txt. +# Use the kernel's default instead. +disable_fw_kms_setup=1 + +# Run in 64-bit mode +arm_64bit=1 + +# Disable compensation for displays with overscan +disable_overscan=1 + +# Run as fast as firmware / board allows +arm_boost=1 + +[cm4] +# Enable host mode on the 2711 built-in XHCI USB controller. +# This line should be removed if the legacy DWC2 controller is required +# (e.g. for USB device mode) or if USB support is not required. +otg_mode=1 + +[all] +kernel_old=1 +disable_commandline_tags=1 +core_freq_min=500 +hdmi_group=1 +hdmi_mode=16 diff --git a/part15-tcpip-webserver/kernel/kernel.c b/part15-tcpip-webserver/kernel/kernel.c index 420afa1..439c283 100644 --- a/part15-tcpip-webserver/kernel/kernel.c +++ b/part15-tcpip-webserver/kernel/kernel.c @@ -59,7 +59,7 @@ ENC_HandleTypeDef handle; unsigned char myMAC[6] = { 0xc0, 0xff, 0xee, 0xc0, 0xff, 0xee }; // IP address to be assigned to the ENC28J60 -unsigned char deviceIP[4] = { 192, 168, 0, 66 }; +unsigned char deviceIP[4] = { 10, 7, 3, 20 }; void init_network(void) {