commit 8ccab92ccd3f32f7b775ef61a2d118531830788a Author: Schrom01 Date: Fri Dec 16 08:38:09 2022 +0100 initial commit diff --git a/CTP_Linker.pdf b/CTP_Linker.pdf new file mode 100644 index 0000000..9ee76ed Binary files /dev/null and b/CTP_Linker.pdf differ diff --git a/project/app/main.c b/project/app/main.c new file mode 100644 index 0000000..fd700cb --- /dev/null +++ b/project/app/main.c @@ -0,0 +1,57 @@ +/* ------------------------------------------------------------------ + * -- _____ ______ _____ - + * -- |_ _| | ____|/ ____| - + * -- | | _ __ | |__ | (___ Institute of Embedded Systems - + * -- | | | '_ \| __| \___ \ Zuercher Hochschule Winterthur - + * -- _| |_| | | | |____ ____) | (University of Applied Sciences) - + * -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland - + * ------------------------------------------------------------------ + * -- + * -- Project : CT2 lab - Linking + * -- + * -- $Id$ + * ------------------------------------------------------------------ + */ + +// Tasks: +// 1. compile without change --> *include* path error (and others) +// 2. fix include path error, i.e. adjust the project properties for C/C++ to +// also use the local .\inc path for includes + +// 3. compile and link --> *compiler* errors +// 4. fix all *compiler* errors, i.e. fix missing includes in main.c + +// 4. compile and link --> *linker* errors +// 5. adjust the project properties for Linker to also link with the +// library lib\read_write.lib + +// 6. compile and link --> fix remaining errors if any + + +#include + +// add missing includes +/// STUDENTS: To be programmed + + + + +/// END: To be programmed + +#define BUTTONS 0x60000210 +#define T0 (1 << 0) + +static uint8_t last = 0; + +int main() +{ + while(1) { + uint8_t buttons = read8(BUTTONS); + uint8_t pressed_T0 = (~last & buttons) & T0; + last = buttons; + + if (pressed_T0) { + toggle(); + } + } +} diff --git a/project/app/toggle.c b/project/app/toggle.c new file mode 100644 index 0000000..4f056be --- /dev/null +++ b/project/app/toggle.c @@ -0,0 +1,27 @@ +/* ------------------------------------------------------------------ + * -- _____ ______ _____ - + * -- |_ _| | ____|/ ____| - + * -- | | _ __ | |__ | (___ Institute of Embedded Systems - + * -- | | | '_ \| __| \___ \ Zuercher Hochschule Winterthur - + * -- _| |_| | | | |____ ____) | (University of Applied Sciences) - + * -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland - + * ------------------------------------------------------------------ + * -- + * -- Project : CT2 lab - Linking + * -- + * -- $Id$ + * ------------------------------------------------------------------ + */ +#include +#include "toggle.h" +#include "write.h" + +#define LED 0x60000100 + +static uint8_t value = 0xC6; + +void toggle(void) +{ + value ^= ~0; + write8(LED, value); +} diff --git a/project/app/toggle.h b/project/app/toggle.h new file mode 100644 index 0000000..2377dae --- /dev/null +++ b/project/app/toggle.h @@ -0,0 +1,20 @@ +/* ------------------------------------------------------------------ + * -- _____ ______ _____ - + * -- |_ _| | ____|/ ____| - + * -- | | _ __ | |__ | (___ Institute of Embedded Systems - + * -- | | | '_ \| __| \___ \ Zuercher Hochschule Winterthur - + * -- _| |_| | | | |____ ____) | (University of Applied Sciences) - + * -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland - + * ------------------------------------------------------------------ + * -- + * -- Project : CT2 lab - Linking + * -- + * -- $Id$ + * ------------------------------------------------------------------ + */ +#ifndef _TOGGLE_H_ +#define _TOGGLE_H_ + +void toggle(void); + +#endif diff --git a/project/inc/read.h b/project/inc/read.h new file mode 100644 index 0000000..d42a838 --- /dev/null +++ b/project/inc/read.h @@ -0,0 +1,8 @@ +#ifndef _READ_H_ +#define _READ_H_ + +#include + +uint8_t read8(uint32_t from); + +#endif diff --git a/project/inc/write.h b/project/inc/write.h new file mode 100644 index 0000000..8896479 --- /dev/null +++ b/project/inc/write.h @@ -0,0 +1,8 @@ +#ifndef _WRITE_H_ +#define _WRITE_H_ + +#include + +void write8(uint32_t to, uint8_t what); + +#endif diff --git a/project/lib/read_write.lib b/project/lib/read_write.lib new file mode 100644 index 0000000..783cb49 Binary files /dev/null and b/project/lib/read_write.lib differ diff --git a/project/lib_debug/read_write.lib b/project/lib_debug/read_write.lib new file mode 100644 index 0000000..5a84f13 Binary files /dev/null and b/project/lib_debug/read_write.lib differ diff --git a/project/lib_debug_with_src/read.c b/project/lib_debug_with_src/read.c new file mode 100644 index 0000000..102534d --- /dev/null +++ b/project/lib_debug_with_src/read.c @@ -0,0 +1,6 @@ +#include "read.h" + +uint8_t read8(uint32_t from) +{ + return (*((volatile uint8_t*)from)); +} diff --git a/project/lib_debug_with_src/read_write.lib b/project/lib_debug_with_src/read_write.lib new file mode 100644 index 0000000..5a84f13 Binary files /dev/null and b/project/lib_debug_with_src/read_write.lib differ diff --git a/project/lib_debug_with_src/write.c b/project/lib_debug_with_src/write.c new file mode 100644 index 0000000..2b3ac61 --- /dev/null +++ b/project/lib_debug_with_src/write.c @@ -0,0 +1,7 @@ +#include "write.h" + +void write8(uint32_t to, uint8_t what) +{ + (*((volatile uint8_t*)to)) = what; +} + diff --git a/project/linker_lab.uvoptx b/project/linker_lab.uvoptx new file mode 100644 index 0000000..ddfd5c7 --- /dev/null +++ b/project/linker_lab.uvoptx @@ -0,0 +1,313 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + Target 1 + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Listings\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + ST-LINKIII-KEIL_SWO + -U303030303030303030303031 -O8398 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:CT_Board_HS14_M0$Flash\STM32F4xx_2048.FLM) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048 -FS08000000 -FL0200000 -FP0($$Device:CT_Board_HS14_M0$Flash\STM32F4xx_2048.FLM)) + + + + + 0 + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + src + 1 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + .\app\main.c + main.c + 0 + 0 + + + 1 + 2 + 5 + 0 + 0 + 0 + .\app\toggle.h + toggle.h + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + .\app\toggle.c + toggle.c + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 + .\lib_debug_with_src\read.c + read.c + 0 + 0 + + + 1 + 5 + 1 + 0 + 0 + 0 + .\lib_debug_with_src\write.c + write.c + 0 + 0 + + + + + inc + 1 + 0 + 0 + 0 + + 2 + 6 + 5 + 0 + 0 + 0 + .\inc\read.h + read.h + 0 + 0 + + + 2 + 7 + 5 + 0 + 0 + 0 + .\inc\write.h + write.h + 0 + 0 + + + + + ::Device + 1 + 0 + 0 + 1 + + + + ::HAL + 1 + 0 + 0 + 1 + + +
diff --git a/project/linker_lab.uvprojx b/project/linker_lab.uvprojx new file mode 100644 index 0000000..a2438cc --- /dev/null +++ b/project/linker_lab.uvprojx @@ -0,0 +1,519 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + Target 1 + 0x4 + ARM-ADS + 6180000::V6.18::ARMCLANG + 6180000::V6.18::ARMCLANG + 1 + + + CT_Board_HS14_M0 + STMicroelectronics + InES.CTBoard14_DFP.4.0.2 + https://ennis.zhaw.ch/pack/ + IRAM(0x20000000,0x30000) IRAM2(0x10000000,0x10000) IROM(0x08000000,0x200000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048 -FS08000000 -FL0200000 -FP0($$Device:CT_Board_HS14_M0$Flash\STM32F4xx_2048.FLM)) + 0 + + + + + + + + + + + $$Device:CT_Board_HS14_M0$SVD\STM32F429x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Objects\ + linker_lab + 1 + 0 + 0 + 1 + 1 + .\Listings\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP-MPU + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + -MPU + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + -1 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 1 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x30000 + + + 1 + 0x8000000 + 0x200000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x200000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x30000 + + + 0 + 0x10000000 + 0x10000 + + + + + + 1 + 2 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 3 + 5 + 1 + 1 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + + + + + + + + + src + + + main.c + 1 + .\app\main.c + + + toggle.h + 5 + .\app\toggle.h + + + toggle.c + 1 + .\app\toggle.c + + + + + ::Device + + + ::HAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\Device\CT_Board_HS14_M0\datainit_ctboard.s + + + + + + + + RTE\Device\CT_Board_HS14_M0\startup_ctboard.s + + + + + + + + RTE\Device\CT_Board_HS14_M0\system_ctboard.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_fmc.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_gpio.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_pwr.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_rcc.c + + + + + + + + + + + + + <Project Info> + 0 + 1 + + + + +