commit bbad8751ee5cdaf4c468d4de04c3a6a943cafb61 Author: Schrom01 Date: Fri Sep 30 07:57:28 2022 +0200 initial commit diff --git a/CTP_BitManipulationen_en.pdf b/CTP_BitManipulationen_en.pdf new file mode 100644 index 0000000..1345d21 Binary files /dev/null and b/CTP_BitManipulationen_en.pdf differ diff --git a/bit_manipulations/app/main.c b/bit_manipulations/app/main.c new file mode 100644 index 0000000..5e9f264 --- /dev/null +++ b/bit_manipulations/app/main.c @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------- + * -- _____ ______ _____ - + * -- |_ _| | ____|/ ____| - + * -- | | _ __ | |__ | (___ Institute of Embedded Systems - + * -- | | | '_ \| __| \___ \ Zurich University of - + * -- _| |_| | | | |____ ____) | Applied Sciences - + * -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland - + * ------------------------------------------------------------------ + * -- + * -- main.c + * -- + * -- main for Computer Engineering "Bit Manipulations" + * -- + * -- $Id: main.c 744 2014-09-24 07:48:46Z ruan $ + * ------------------------------------------------------------------ + */ +//#include +#include "utils_ctboard.h" + +#define ADDR_DIP_SWITCH_31_0 0x60000200 +#define ADDR_DIP_SWITCH_7_0 0x60000200 +#define ADDR_LED_31_24 0x60000103 +#define ADDR_LED_23_16 0x60000102 +#define ADDR_LED_15_8 0x60000101 +#define ADDR_LED_7_0 0x60000100 +#define ADDR_BUTTONS 0x60000210 + +// define your own macros for bitmasks below (#define) +/// STUDENTS: To be programmed + + + + +/// END: To be programmed + +int main(void) +{ + uint8_t led_value = 0; + + // add variables below + /// STUDENTS: To be programmed + + + + + /// END: To be programmed + + while (1) { + // ---------- Task 3.1 ---------- + led_value = read_byte(ADDR_DIP_SWITCH_7_0); + + /// STUDENTS: To be programmed + + + + + /// END: To be programmed + + write_byte(ADDR_LED_7_0, led_value); + + // ---------- Task 3.2 and 3.3 ---------- + /// STUDENTS: To be programmed + + + + + /// END: To be programmed + } +} diff --git a/bit_manipulations/app/utils_ctboard.c b/bit_manipulations/app/utils_ctboard.c new file mode 100644 index 0000000..5c4e1eb --- /dev/null +++ b/bit_manipulations/app/utils_ctboard.c @@ -0,0 +1,103 @@ +/* ---------------------------------------------------------------------------- + * -- _____ ______ _____ - + * -- |_ _| | ____|/ ____| - + * -- | | _ __ | |__ | (___ Institute of Embedded Systems - + * -- | | | '_ \| __| \___ \ Zurich University of - + * -- _| |_| | | | |____ ____) | Applied Sciences - + * -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland - + * ---------------------------------------------------------------------------- + * -- + * -- Project : CT Board - Cortex M4 + * -- Description : Utilities for ct board. + * -- + * -- $Id: utils_ctboard.c 2160 2015-06-08 12:28:00Z feur $ + * ------------------------------------------------------------------------- */ + +#include +#include "utils_ctboard.h" + +/* ---------------------------------------------------------------------------- + * -- Functions + * ---------------------------------------------------------------------------- + */ + +/* + * See header file + */ +uint8_t read_byte(uint32_t address) +{ + uint8_t *pointer; + pointer = (uint8_t *)address; + return *pointer; +} + +/* + * See header file + */ +uint16_t read_halfword(uint32_t address) +{ + uint16_t *pointer; + pointer = (uint16_t *)address; + return *pointer; +} + +/* + * See header file + */ +uint32_t read_word(uint32_t address) +{ + uint32_t *pointer; + pointer = (uint32_t *)address; + return *pointer; +} + +/* + * See header file + */ +uint64_t read_doubleword(uint32_t address) +{ + uint64_t *pointer; + pointer = (uint64_t *)address; + return *pointer; +} + + +/* + * See header file + */ +void write_byte(uint32_t address, uint8_t data) +{ + uint8_t *pointer; + pointer = (uint8_t *)address; + *pointer = data; +} + +/* + * See header file + */ +void write_halfword(uint32_t address, uint16_t data) +{ + uint16_t *pointer; + pointer = (uint16_t *)address; + *pointer = data; +} + +/* + * See header file + */ +void write_word(uint32_t address, uint32_t data) +{ + uint32_t *pointer; + pointer = (uint32_t *)address; + *pointer = data; +} + +/* + * See header file + */ +void write_doubleword(uint32_t address, uint64_t data) +{ + uint64_t *pointer; + pointer = (uint64_t *)address; + *pointer = data; +} diff --git a/bit_manipulations/app/utils_ctboard.h b/bit_manipulations/app/utils_ctboard.h new file mode 100644 index 0000000..b946a56 --- /dev/null +++ b/bit_manipulations/app/utils_ctboard.h @@ -0,0 +1,52 @@ +/* ---------------------------------------------------------------------------- + * -- _____ ______ _____ - + * -- |_ _| | ____|/ ____| - + * -- | | _ __ | |__ | (___ Institute of Embedded Systems - + * -- | | | '_ \| __| \___ \ Zurich University of - + * -- _| |_| | | | |____ ____) | Applied Sciences - + * -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland - + * ---------------------------------------------------------------------------- + * -- + * -- Module : ctboard_utils + * -- Description : Interface for module. + * -- + * -- $Id: utils_ctboard.h 1122 2015-01-06 13:57:04Z feur $ + * ------------------------------------------------------------------------- */ +#ifndef _UTILS_CTBOARD +#define _UTILS_CTBOARD + +#include + +/* ---------------------------------------------------------------------------- + * -- Function prototypes + * ---------------------------------------------------------------------------- + */ + +/* + * Functions to read either a byte, halfword, word or + * doubleword from an arbitrary address. + * @param address: address to read from (32 bit) + * @retval data @ address + */ +uint8_t read_byte(uint32_t address); +uint16_t read_halfword(uint32_t address); +uint32_t read_word(uint32_t address); +uint64_t read_doubleword(uint32_t address); + + +/* + * Functions to write either a byte, halfword, word or + * doubleword to an arbitrary address. + * @param address: address to write to (32 bit) + * data: data to write @ address + */ +void write_byte(uint32_t address, uint8_t data); +void write_halfword(uint32_t address, uint16_t data); +void write_word(uint32_t address, uint32_t data); +void write_doubleword(uint32_t address, uint64_t data); + +/* ---------------------------------------------------------------------------- + * -- Header file end + * ---------------------------------------------------------------------------- + */ +#endif diff --git a/bit_manipulations/bitmanipulation.uvoptx b/bit_manipulations/bitmanipulation.uvoptx new file mode 100644 index 0000000..1f951a5 --- /dev/null +++ b/bit_manipulations/bitmanipulation.uvoptx @@ -0,0 +1,225 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + Target 1 + 0x4 + ARM-ADS + + 180000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\build\ + + + 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 + ST-LINKIII-KEIL_SWO + -U066EFF535353897167065027 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -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 + 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 + + + + + + + + + + + + + app + 1 + 0 + 0 + 0 + + 1 + 1 + 1 + 1 + 0 + 0 + .\app\main.c + main.c + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + .\app\utils_ctboard.c + utils_ctboard.c + 0 + 0 + + + + + ::Device + 0 + 0 + 0 + 1 + + + + ::HAL + 0 + 0 + 0 + 1 + + +
diff --git a/bit_manipulations/bitmanipulation.uvprojx b/bit_manipulations/bitmanipulation.uvprojx new file mode 100644 index 0000000..1dc5ceb --- /dev/null +++ b/bit_manipulations/bitmanipulation.uvprojx @@ -0,0 +1,524 @@ + + + + 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/ + IROM(0x08000000,0x200000) IRAM(0x20000000,0x30000) IRAM2(0x10000000,0x10000) CPUTYPE("Cortex-M0") CLOCK(180000000) 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 + + .\build\ + bitmanipulation + 1 + 0 + 0 + 1 + 1 + .\build\ + 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 + -MPU + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + -MPU + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 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 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 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 + 0 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + --diag_suppress 6314 + + + + + + + + app + + + main.c + 1 + .\app\main.c + + + utils_ctboard.c + 1 + .\app\utils_ctboard.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 + + + + +