From 3a161a118111f8631e090244e837ea561a5c6983 Mon Sep 17 00:00:00 2001 From: ayabusa Date: Sun, 31 Mar 2024 18:17:46 +0200 Subject: [PATCH] added led interface --- .vscode/settings.json | 4 +- numworks_port/Makefile | 5 +- numworks_port/README.md | 2 +- numworks_port/build/Laplace/led.o | Bin 0 -> 5068 bytes numworks_port/build/main.bin | Bin 65916 -> 66304 bytes numworks_port/build/main.elf | Bin 85208 -> 87284 bytes numworks_port/build/rt0.o | Bin 6264 -> 0 bytes numworks_port/build/start_handler.o | Bin 0 -> 6448 bytes numworks_port/src/Laplace/README.md | 2 + numworks_port/src/Laplace/led.cpp | 59 +++++++++++++ numworks_port/src/Laplace/led.h | 23 +++++ numworks_port/src/core.S.BAK | 79 ------------------ numworks_port/src/linker.ld | 23 +++-- numworks_port/src/main.c.BAK | 21 ----- numworks_port/src/main.h.BAK | 7 -- .../src/{rt0.cpp => start_handler.cpp} | 17 ++-- 16 files changed, 118 insertions(+), 124 deletions(-) create mode 100644 numworks_port/build/Laplace/led.o delete mode 100644 numworks_port/build/rt0.o create mode 100644 numworks_port/build/start_handler.o create mode 100644 numworks_port/src/Laplace/README.md create mode 100644 numworks_port/src/Laplace/led.cpp create mode 100644 numworks_port/src/Laplace/led.h delete mode 100644 numworks_port/src/core.S.BAK delete mode 100644 numworks_port/src/main.c.BAK delete mode 100644 numworks_port/src/main.h.BAK rename numworks_port/src/{rt0.cpp => start_handler.cpp} (89%) diff --git a/.vscode/settings.json b/.vscode/settings.json index 8d5cb57..13b0224 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,6 +17,8 @@ "streambuf": "cpp", "system_error": "cpp", "tuple": "cpp", - "main.h": "c" + "main.h": "c", + "led.h": "c", + "stm32f730xx.h": "c" } } \ No newline at end of file diff --git a/numworks_port/Makefile b/numworks_port/Makefile index d7a1831..cce2ae8 100644 --- a/numworks_port/Makefile +++ b/numworks_port/Makefile @@ -50,18 +50,19 @@ LFLAGS += -mthumb LFLAGS += -Wall LFLAGS += --specs=nosys.specs LFLAGS += -nostdlib -LFLAGS += -lgcc LFLAGS += -T$(LSCRIPT) # AS_SRC = $(SRC_DIR)/core.S #C_SRC = $(SRC_DIR)/main.c -CPP_SRC := $(wildcard $(SRC_DIR)/*.cpp) +CPP_SRC := $(wildcard $(SRC_DIR)/*.cpp) $(wildcard $(SRC_DIR)/Laplace/*.cpp) +C_SRC := $(wildcard $(SRC_DIR)/*.c) $(wildcard $(SRC_DIR)/Laplace/*.c) INCLUDE = -I./ INCLUDE += -I./device #OBJS = $(BUILD_DIR)/$(notdir $(AS_SRC:.S=.o)) #OBJS += $(BUILD_DIR)/$(notdir $(C_SRC:.c=.o)) +OBJS += $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SRC)) OBJS += $(patsubst $(SRC_DIR)/%.cpp, $(BUILD_DIR)/%.o, $(CPP_SRC)) .PHONY: all diff --git a/numworks_port/README.md b/numworks_port/README.md index e43026c..ddcec10 100644 --- a/numworks_port/README.md +++ b/numworks_port/README.md @@ -10,6 +10,6 @@ This is a bare metal os attempt on the numworks n0110 ## TODO - [x] Working thing -- [ ] Led interface +- [x] Led interface - [ ] Keyboard interface - [ ] Screen interface \ No newline at end of file diff --git a/numworks_port/build/Laplace/led.o b/numworks_port/build/Laplace/led.o new file mode 100644 index 0000000000000000000000000000000000000000..1951be54e8b1cb12468307f2bcb12862a00fab1c GIT binary patch literal 5068 zcmcgvTWlOx89rxbXV>vwvi2si*G|&4n}UP2yIwnu?IdpEI8NkCYS&3BYEo@xcgNnP zdt+zTahjqm#fV7oKzM*YR8WNA0T4+;C?y4;*Rc`!C=5&wu`NncXYX^CvmyOg7F2*rvwVfw1k-4%jfjy4Wt(xW%sTnd{B( zo_+ZKF*9V5-q*W9P_yJjDLJFK3$umko8ak7yM9gxGsfgA!S2u=(fKkV(0 zRW)*<4YF@`>TM2L1IGh92Z!DM`N^l>^<1u=Vz-$`Io7!K`5WxIdh)?%9$aFBzPo|B z-t{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ZJ(fnk* zWmg}F%nQdmB#0)*Dngesx&97bj0Dl7FAv>4ZU9$3oe3J3z6x^OE0AR$h%AavAk9TK zDPD%b9d9?{QT`NV&EcAx{C1|KB(M7xWSYidZLDWiTl614T~%=ku1% z=Jj&^z{D(^%1PA8TKDxW>5fO24=?zCt++0CWnSC z4C`gRr88u_l)pF>3nxec*^*w)UmA*q>l4Jiqcg<3ls^bC2PcRCC4@nWl7$llfouVg zA|RU&sD>A)MggdX8z{~NWHU1hCvX7S>_CSx0@+xC5QX z0&+m}28Q*_ZodnES2Ad`U*PeUu5bq0cxzKVm$y^_+XJ9M6(A?v+QbIrvwBNauzE)& zGVJF8`V3~!36Rfl8m0i$i)DHdK--V0ysj%>bma Ndx{6XXy delta 144 zcmZo@WBJp>(lCYbN4V&Ec2~RPP|KB(M7xxkeidZLDWiTj;0!2>$7x9+P z7WQ)fz{D(^EaWYnA?T(2#i3X@fgi}`^K$;u0A%xcM`v(*DSr@P4o=|o7Ep>xWZ2KJ lpTm5wTf^QX%nS-3T*K%%;RKY;V8P_Tz{14pz#zcD004^XESvxU diff --git a/numworks_port/build/main.elf b/numworks_port/build/main.elf index 3e81d598c56d43ad8bcbe7fba3d2ecdb79dbddf0..e0cbe7893250abeee2226f9a9cd66e6e602b198f 100755 GIT binary patch delta 4958 zcma)AdvH|c75~nC>~8jzeI%RRB*5k&qOqHY2?-F$lO@@WCN5ABfxHM!Y{Z2`hzQ+u z#M%znNv3sfYtv43MxD-dK=2W3hXH1+=+w4Oopz|B9jo;Zr*#UIRz}eDcfQ@5Y!s*7 zVekE&=XcKe?m71h=YOnU`h`9fR%&mXE*;oWOeFYc6}UV?5FRg;k$6cJVWGB6FI5Y990V6#|E1ZI>p;{HeZz_?^RnSlI=Sy0I@00zWGa`un`V9##T& zL&pW3FmxQ?+ksWp-)951A}|8hp`(FM&=IFkMYmtp?oVz&cp3-rz|-Qm8ojdT%6+23 z`noe-G|`3?-#nSJ#|x8|ci?D(LwNI~1+*S7oY3Q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9wVKI0b+x z$8c8kTMW?Zi_n$^_7L=*gb-JwxYMZL27J_~ZFsB?!gG*W#qvin*!2Pk>=%|2(9-)S DK2H&2 diff --git a/numworks_port/build/start_handler.o b/numworks_port/build/start_handler.o new file mode 100644 index 0000000000000000000000000000000000000000..abcdf0d5d5ddbde3f283141cb06d8c919a765a75 GIT binary patch literal 6448 zcmcgxdu(J?89(RF-08H_nLeiP@|Z3K3Y(efwB7A?w}rOT2i+I7T?pcm>7AL|&MfnC z?w!)z<+0+*q7Y?~$RjAmM8Yh7OY5m;v}aOBHFn9mR(Iw|dOh7W^%TCIsphq=!g`tyu50h7kER}(Jp1Z;s$-^i z_}Q78-g6!;%zoI*dWpQ$oOv4d{;BtGtG55!X8R}aL=?@t{d->RI=XZu)jZdD&AE3! zIM=kh36fn)J5#KuK}dXix^MRGj-FK<{sd|8z{Zz7$DVT|ren{7I$znLjPnQiCr+Jm zAGexmer8Y!?~+2r$(YJGzKr>PhfmK#4#rY)D$h!-2B(_Nnan)~Uinq~2!XR^L;<+f zmx*&b--M0AU0xD$_q)U?>L9f#HOENkRAUgjHHaM7cHUO@ajo!C(+P0*+{&Y9?c+DYwpPgd z`Nfdb33`bC8u}hV@8Gr2sTV#+`BTvG3i&u!;m0TFDei|(gYbC`EHQi`pXYBvr%BKU z_~#&R7W57LLg@R2&x8E)&}k9!CH@b{TLqoumxFE-K2v-Ow(UY*sEsZzuns|+JOZ6g zp|i$+2|ryzevHpSzgy79`Cp-PfuQf^k0H7X1${4n9P~wkzK^xk!9Wct4q7co2A}$y z;0}54ML;Xjju)Ws71SxPK0!HTW_P{!iia ze5I+464}+{Isj-t0x=HQ95+G7F6oDs7H& zVMts@!7MVqrJHEwWYYOCTDJ6FhOcsR$@vEiXUjm@>p@q6UD9%k&?~rBS+D;(p_TXE z2)qc@m1dVW$q+E*&KgpvKLd-l@8CmSP@w?$qwj!o?xMCz-%q2rwjpY;`fiKLzSYw( zYWJ**wu1T^u%n4#VwIB_ZwuObQPF?*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EN_LED_PIN*2)); + GPIOB->OTYPER &= ~(1 << GREEN_LED_PIN); + + // setup blue led + GPIOB->MODER &= ~(0x3 << (BLUE_LED_PIN*2)); + GPIOB->MODER |= (0x1 << (BLUE_LED_PIN*2)); + GPIOB->OTYPER &= ~(1 << BLUE_LED_PIN); +} + +void set_led_red(bool state){ + if(state){ + led_state |= (1 << RED_LED_PIN); + }else{ + led_state &= ~(1 << RED_LED_PIN); + } + GPIOB->ODR = led_state; +} + +void set_led_green(bool state){ + if(state){ + led_state |= (1 << GREEN_LED_PIN); + }else{ + led_state &= ~(1 << GREEN_LED_PIN); + } + GPIOB->ODR = led_state; +} + +void set_led_blue(bool state){ + if(state){ + led_state |= (1 << BLUE_LED_PIN); + }else{ + led_state &= ~(1 << BLUE_LED_PIN); + } + GPIOB->ODR = led_state; +} + +void set_led_all(bool state){ + if(state){ + led_state = (1 << RED_LED_PIN) | (1 << GREEN_LED_PIN) | (1 << BLUE_LED_PIN); + }else{ + led_state = 0; + } + GPIOB->ODR = led_state; +} \ No newline at end of file diff --git a/numworks_port/src/Laplace/led.h b/numworks_port/src/Laplace/led.h new file mode 100644 index 0000000..60b22d2 --- /dev/null +++ b/numworks_port/src/Laplace/led.h @@ -0,0 +1,23 @@ +/** @file led.h + * + * @brief Control the led + * + */ + +#ifndef LED_H +#define LED_H + +#define RED_LED_PIN (4) +#define GREEN_LED_PIN (5) +#define BLUE_LED_PIN (0) + +#include +#include "../device/stm32f730xx.h" + +void led_init(); +void set_led_red(bool state); +void set_led_green(bool state); +void set_led_blue(bool state); +void set_led_all(bool state); + +#endif \ No newline at end of file diff --git a/numworks_port/src/core.S.BAK b/numworks_port/src/core.S.BAK deleted file mode 100644 index 6e9ddf1..0000000 --- a/numworks_port/src/core.S.BAK +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Test program to boot an STM32 chip with the absolute - * minimum required code for teaching about the chips. - * - * Copyright William Ransohoff, Vivonomicon, LLC, 2017 - * - * Open source under the MIT License - */ - -.syntax unified -.cpu cortex-m7 -.fpu softvfp -.thumb - -// Global values. -.global vtable -.global reset_handler - -/* - * The vector table. - * Most entries are ommitted for simplicity. - */ - -/* - * The Reset handler. Called on reset. - */ -.type reset_handler, %function -reset_handler: - // Set the stack pointer to the end of the stack. - // The '_estack' value is defined in our linker script. - LDR r0, =_estack - MOV sp, r0 - - // Copy data from flash to RAM data init section. - // R2 will store our progress along the sidata section. - MOVS r0, #0 - // Load the start/end addresses of the data section, - // and the start of the data init section. - LDR r1, =_sdata - LDR r2, =_edata - LDR r3, =_sidata - B copy_sidata_loop - - copy_sidata: - // Offset the data init section by our copy progress. - LDR r4, [r3, r0] - // Copy the current word into data, and increment. - STR r4, [r1, r0] - ADDS r0, r0, #4 - - copy_sidata_loop: - // Unless we've copied the whole data section, copy the - // next word from sidata->data. - ADDS r4, r0, r1 - CMP r4, r2 - BCC copy_sidata - - // Once we are done copying the data section into RAM, - // move on to filling the BSS section with 0s. - MOVS r0, #0 - LDR r1, =_sbss - LDR r2, =_ebss - B reset_bss_loop - - // Zero out the BSS segment. - reset_bss: - // Store a 0 and increment by a word. - STR r0, [r1] - ADDS r1, r1, #4 - - reset_bss_loop: - // We'll use R1 to count progress here; if we aren't - // done, reset the next word and increment. - CMP r1, r2 - BCC reset_bss - - // Branch to the 'main' method. - B main -.size reset_handler, .-reset_handler \ No newline at end of file diff --git a/numworks_port/src/linker.ld b/numworks_port/src/linker.ld index b2e3544..8dfd328 100644 --- a/numworks_port/src/linker.ld +++ b/numworks_port/src/linker.ld @@ -1,9 +1,11 @@ -/* Label for the program's entry point */ -/*ENTRY(reset_handler)*/ -/* End of RAM / Start of stack */ -/* (4KB SRAM) */ +/* This is the linker file it required to map out the memory. + * This linker is heavely inspired by epsilon/omega/upsilon and their bootloader_common.ld. + * It is necessary if we want our os to be considered as valid. + * At this time we can only compile this os to slot B, but it might change in the future */ -/* epsilon stuff */ + + +/* numworks stuff */ STACK_SIZE = 32K; FIRST_FLASH_SECTOR_SIZE = 4K; SIGNED_PAYLOAD_LENGTH = 8; @@ -28,15 +30,18 @@ SECTIONS . = ORIGIN(FLASH) + SIGNED_PAYLOAD_LENGTH; } >FLASH + /* Contains some info and is requiered to be considered as a valid slot by the bootloader. + * Located in info_headers.cpp */ .kernel_header : { KEEP(*(.kernel_header)) } >FLASH + /* Nothing in there for now */ .slot_info : { *(.slot_info*) } >RAM - /* The vector table goes at the start of flash. */ + /* The vector table (handle all the interrupts) located in vector_table.cpp */ .isr_vector_table ORIGIN(RAM) + 512 : AT(ORIGIN(FLASH) + SIZEOF(.signed_payload_prefix) + SIZEOF(.kernel_header)) { /* When booting, the STM32F412 fetches the content of address 0x0, and * extracts from it various key infos: the initial value of the PC register @@ -57,6 +62,7 @@ SECTIONS _isr_vector_table_end_ram = .; } >RAM + /* this is to prevent the bootloader from booting straight up in our os (we set all to 0) */ .exam_mode_buffer ORIGIN(FLASH) + SIZEOF(.signed_payload_prefix) + SIZEOF(.kernel_header) + SIZEOF(.isr_vector_table) : { . = ALIGN(4K); _exam_mode_buffer_start = .; @@ -66,7 +72,8 @@ SECTIONS _exam_mode_buffer_end = .; } >FLASH - /* External flash memory */ + /* Contains some more info and is requiered to be considered as a valid slot by the bootloader. + * Located in info_headers.cpp */ .userland_header : { . = ORIGIN(FLASH) + USERLAND_OFFSET; KEEP(*(.userland_header)); @@ -77,6 +84,7 @@ SECTIONS *(.text) *(.text.*) } >FLASH + /* The 'rodata' section contains read-only data, * constants, strings, information that won't change. */ .rodata : { @@ -84,6 +92,7 @@ SECTIONS *(.rodata.*) } >FLASH + /* TODO, understand what is it's purpose */ .init_array : { . = ALIGN(4); _init_array_start = .; diff --git a/numworks_port/src/main.c.BAK b/numworks_port/src/main.c.BAK deleted file mode 100644 index b2c6a83..0000000 --- a/numworks_port/src/main.c.BAK +++ /dev/null @@ -1,21 +0,0 @@ -#include "main.h" - -/* Main program. */ -int main(void) { - // Enable the GPIOa and GPIOC peripheral in RCC. - RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN ; - - // C0 is connected to the LED - // It should be set to push-pull low-speed output. - GPIOB->MODER &= ~(0x3 << (LED_PIN*2)); - GPIOB->MODER |= (0x1 << (LED_PIN*2)); - GPIOB->OTYPER &= ~(1 << LED_PIN); - - // set the led on - GPIOB->ODR = (1 << LED_PIN); - while (0) - { - GPIOB->ODR = (1 << LED_PIN); - } - -} \ No newline at end of file diff --git a/numworks_port/src/main.h.BAK b/numworks_port/src/main.h.BAK deleted file mode 100644 index b1f960e..0000000 --- a/numworks_port/src/main.h.BAK +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _VVC_MAIN_H -#define _VVC_MAIN_H -#include -#include "device/stm32f730xx.h" -// Define GPIOB pin mappings for our LED and button. -#define LED_PIN (3) // led on PC0 -#endif \ No newline at end of file diff --git a/numworks_port/src/rt0.cpp b/numworks_port/src/start_handler.cpp similarity index 89% rename from numworks_port/src/rt0.cpp rename to numworks_port/src/start_handler.cpp index 2d3ffee..8f5e097 100644 --- a/numworks_port/src/rt0.cpp +++ b/numworks_port/src/start_handler.cpp @@ -2,8 +2,9 @@ #include #include #include "device/stm32f730xx.h" +#include "Laplace/led.h" -#define LED_PIN (4) // PC0 +//#define LED_PIN (4) // PB0 typedef void (*cxx_constructor)(); @@ -42,6 +43,7 @@ void* memset_custom(void* ptr, int value, size_t num_bytes) { return ptr; } +// This the first function when the os boot void __attribute__((noinline)) start() { /* Copy data section to RAM * The data section is R/W but its initialization value matters. It's stored @@ -56,19 +58,22 @@ void __attribute__((noinline)) start() { size_t bssSectionLength = (&_bss_section_end_ram - &_bss_section_start_ram); memset_custom(&_bss_section_start_ram, 0, bssSectionLength); - // Enable the GPIOa and GPIOC peripheral in RCC. + // Enable the GPIO peripheral in RCC. RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN ; - - // C0 is connected to the LED. + led_init(); + set_led_green(true); + set_led_red(true); + /* + // B0 is connected to the LED. // It should be set to push-pull low-speed output. GPIOB->MODER &= ~(0x3 << (LED_PIN*2)); GPIOB->MODER |= (0x1 << (LED_PIN*2)); GPIOB->OTYPER &= ~(1 << LED_PIN); GPIOB->ODR = (1 << LED_PIN); - + */ while (0) { - GPIOB->ODR = (1 << LED_PIN); + // code } } \ No newline at end of file