From e9d949748b649161669f588372ac9dd973a5bb16 Mon Sep 17 00:00:00 2001 From: ayabusa Date: Sun, 31 Mar 2024 15:47:23 +0200 Subject: [PATCH] the led is finally working --- .vscode/settings.json | 3 ++- numworks_port/build/main.bin | Bin 65856 -> 65916 bytes numworks_port/build/main.elf | Bin 83700 -> 85208 bytes numworks_port/build/rt0.o | Bin 4276 -> 6264 bytes numworks_port/build/vector_table.o | Bin 2540 -> 2544 bytes numworks_port/src/linker.ld | 8 +++++++- numworks_port/src/rt0.cpp | 17 ++++++++++++++++- numworks_port/src/vector_table.cpp | 4 ++-- 8 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 0ab8f97..8d5cb57 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,7 @@ "stdexcept": "cpp", "streambuf": "cpp", "system_error": "cpp", - "tuple": "cpp" + "tuple": "cpp", + "main.h": "c" } } \ No newline at end of file diff --git a/numworks_port/build/main.bin b/numworks_port/build/main.bin index ff6161c8de4664554ae050ddf173b5f199ed26f4..5f5d8c7b5d32c3b846b864e4bbf9ee31a6cffd9e 100755 GIT binary patch delta 160 zcmX@m#PX+!Wr707kN?aHpBWq{Y-Uur!M{o1$A@|eFG=sqQq>7n84{ji9{;~@{4ee$ z4ivFYu*zUi6a|W${x9M!oh|I;{DFyCI9bSBIz!M)`HMrbZ~{M&&FAI(r2)w1@s7^m z_EP>Jz#N>w=`ElXmB_H4VLylYUblw5N0=EDK)8m{al#2Go56y~fq{jI)qz2PfdK%` C1~bM0 delta 99 zcmey<#B!jCWr6~Si=vvsX9mX!n;8{u@NW|M@xg=Ji^u!2RCPjC2Dc}t$N%pe|8se9 v0Y$76tTGrBIe;Rk|1<1o*w10U*R5eM!~P@83<@CZ!00&P1eDDnz`y_iUn(NN diff --git a/numworks_port/build/main.elf b/numworks_port/build/main.elf index 056273f9f478682c6b0a7103230c90dc814284fc..3e81d598c56d43ad8bcbe7fba3d2ecdb79dbdd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~yBg_~>?CQrAo-X?5T%cflbXST){aC3u+7Wh&*ZOf) O`R)z`$qq*rHv2C)Rf0AE diff --git a/numworks_port/build/rt0.o b/numworks_port/build/rt0.o index 298d4c8d694085c8053b188eb70ec24c3df33b9b..86c4d359a45ebdcdae070266ad28bfd9eb8145ae 100644 GIT binary patch literal 6264 zcmcgweQaCR6~Fh{FLvYD`Eb6|f!ziObdKXBG$~DK5+_ZQ^doc1C~cYZV!y-&f6ebX z>j#L6A=n0Dl%X*}C6GYcG$sM#qiY#r5=cnXCMM7}#3qeRNJE-51%X6G2Ho#m-{(AM zowk3rE4}+W=iGD7J@?#C`>x4-dpPIJDxCGOb&j$3n?;K{D4>V6u~v5a#cw~yp1rtm ze&OW8TIv<;mDDMXZC%r9-#?jNOLtD3N9~ztI^J1WOY?y>?X&c$)MMkT@2sWT_jC`v zy64u5&Qpb{fAz9fA}_A@FTmbE@!6f#_8)Jwf9Y;S(LU2L`%dSng_EiF>DIlMKKO^td(Dk#PrqvArV59ZQRc*lLiySw@m`5XoQ$cAqh_q}H>iR)D~uhL zsjZXPZxZr8ehnnGf*#~=L*FClVO|HFI^lDKKMftPkdN{&pyLzt1aE~-z3{mgQpOsD ze2)Je@iYqh5I+fdlb{dt0QCLB=P~|6=rjxY0{=baErL$+>p-^(pD8{H+cqIDIHL10 z)-Gt14??Fy=p5%C!cV7=pXQU$?-KMq{7vX=7WB9H!-(!nf_{KM4*Ci~Kg4{sFbF77 zh@3}3dRE~KOY?bvpJ?X=G}Q^}4X|E8{TZHpg8D9O>WON85ETyvXwQg!bM|H^)ud1j z)P^8b&X_fKLT6ZV1y=ta*x(E_evOYd-6%eOmbjLJS!6ueMYM7zsosN@VE5Iil`{+K zdx$C6U-o*;RbX41-x7KS*9zO}ze#B28;$^JEx6L`>P8s?GV64cLj8H_TVf(iw| z&+ezaej~M2`hEeuwG2{&)ptu&_FeM=j9NYOqODN#JnY&U4+}2SK&NdtKJ?$Y-oHDB z<~BFw%>5}U#=XqpyCJ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7CpLt;+@}wqB^z2XGe- z`hdiUdr^F(Cw$~QN=|!;BP3j&7oTyQaI!ugMBmEQ%51MKsb}ZJrY|mv-dB6(3Uj&Id?wd0 zt?C>}>eEf;;X-BBDvEDI3310es%2(OQ@j-FKO(oz$Tw;q1n>X&WLnv}McCCWSX;ZA z^_;!JtTyU7WL(efu3Lk8#CnsRT^`dnR%;VZkL6EMcCga z7X43(AN}PP`K3(+^b7n=HW3I-_}$Nn=K|lbRk0(u!lqV!3ihznDmXk!v@S75^tnXz z`YVZO)D05t;mX2O(!|qyUSUCDRpGqC*A%{?@RCF{>WZ?jDqL6ig~FQ>!TU|w|0?W} z9|@-%jY|ayJfUz>q5Q?jh11HeC_Jn1qQbWnzAq7cyl~=Pyg+sEC$w@qGQ{`>iSB5M zzvmT?Mbk_ZOVPME7Y*6kPGxV{_GWY^zvUI)SlZQzO>Z*sNG#?03w!o5@dDIeam*bO z=VK{;%OO6DrFpAQdM+!_G1J0m}{|YxFj(-dvXX%$K-x?&dE<$UN9O>KFeyw1Cd|=N*9%E z7G`_O$S5%RC%ZqR!emd5a>jzm2RVY7{xM7z<5Xe{m~6?Z&Ny{)B9J^Wxsy|!^#&^g WgT>^FEW(pda0;+iurV+!2JrxFLASH + .init_array : { + . = ALIGN(4); + _init_array_start = .; + KEEP (*(.init_array*)) + _init_array_end = .; + } >FLASH + /* The 'data' section is space set aside in RAM for * things like variables, which can change. */ .data : { diff --git a/numworks_port/src/rt0.cpp b/numworks_port/src/rt0.cpp index 948a356..2d3ffee 100644 --- a/numworks_port/src/rt0.cpp +++ b/numworks_port/src/rt0.cpp @@ -1,5 +1,9 @@ #include "vector_table.h" #include +#include +#include "device/stm32f730xx.h" + +#define LED_PIN (4) // PC0 typedef void (*cxx_constructor)(); @@ -52,8 +56,19 @@ 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. + 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); + + GPIOB->ODR = (1 << LED_PIN); + while (0) { - /* code */ + GPIOB->ODR = (1 << LED_PIN); } } \ No newline at end of file diff --git a/numworks_port/src/vector_table.cpp b/numworks_port/src/vector_table.cpp index 8b875a9..948a363 100644 --- a/numworks_port/src/vector_table.cpp +++ b/numworks_port/src/vector_table.cpp @@ -1,5 +1,5 @@ #include "vector_table.h" -extern const void * _estack; +extern const void * _stack_start; /* Interrupt Service Routines are void->void functions */ typedef void(*ISR)(void); @@ -16,7 +16,7 @@ ISR InitialisationVector[INITIALISATION_VECTOR_SIZE] __attribute__((section(".isr_vector_table"))) __attribute__((used)) = { - (ISR)&_estack, // Stack start + (ISR)&_stack_start, // Stack start start, // Reset service routine, 0, // NMI service routine, 0, // HardFault service routine,