From d362a616a009823dd51c366c60f4fc2b44987356 Mon Sep 17 00:00:00 2001 From: Lucas Merritt Date: Fri, 26 Apr 2024 16:29:24 -0600 Subject: [PATCH] Build changes --- .github/workflows/act.yml | 11 +++++++++++ .github/workflows/build.yml | 2 +- Makefile | 5 ++++- src/hal/.hal.h.swp | Bin 0 -> 12288 bytes src/hal/hal.c | 4 ++-- src/hal/hal.h | 4 ++-- 6 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/act.yml create mode 100644 src/hal/.hal.h.swp diff --git a/.github/workflows/act.yml b/.github/workflows/act.yml new file mode 100644 index 0000000..0d5aa16 --- /dev/null +++ b/.github/workflows/act.yml @@ -0,0 +1,11 @@ +name: act-build + +jobs: + act-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: apt-get update + - run: apt install sudo + - run: sudo apt -y install gcc-arm-none-eabi make openocd git + - run: make diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f39dd82..aac916d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,5 +12,5 @@ jobs: steps: - uses: actions/checkout@v3 - run: sudo apt-get update - - run: sudo apt -y install gcc-arm-none-eabi make openocd + - run: sudo apt -y install gcc-arm-none-eabi make openocd git - run: make diff --git a/Makefile b/Makefile index cea9f6e..0196b0d 100644 --- a/Makefile +++ b/Makefile @@ -79,4 +79,7 @@ debug: @openocd -f interface/stlink.cfg -f board/stm32f0discovery.cfg -c "init" & @arm-none-eabi-gdb bin/firmware.elf -x gdbconf -.PHONY: all dep cmsis_core cmsis_f0 build clean dep_clean flash debug +test: + @act --job act-linux + +.PHONY: all dep cmsis_core cmsis_f0 build clean dep_clean flash debug test diff --git a/src/hal/.hal.h.swp b/src/hal/.hal.h.swp new file mode 100644 index 0000000000000000000000000000000000000000..e88d1dcbbf68918ff1dee655db2b9dc0ff585ff6 GIT binary patch literal 12288 zcmeI2&u<$=6vwAXKm!yI+|i?Hi8pclD}knIY2_xSv2dIaI|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dkY@j07xinF|`E9 z8+)=7i%6Yo>vKIP_Ks9aj+@BX(T6$CJ~wvap>lRo*$d{ECD grjF-GzCKr4EtD@5Dyz!U#laRheOR+!*cTVs-^yF2z5oCK literal 0 HcmV?d00001 diff --git a/src/hal/hal.c b/src/hal/hal.c index 3d3762d..38f20d4 100644 --- a/src/hal/hal.c +++ b/src/hal/hal.c @@ -42,7 +42,7 @@ uint8_t gpio_read(uint16_t pin) void rcc_port_set(uint8_t bank, uint8_t mode) { int n = (17 + bank); - RCC->AHBENR = (RCC->AHBENR & ~BIT(n)) | (mode << n); /* Clear, then set bit. */ + RCC->AHBENR = (RCC->AHBENR & ~BIT(n)) | (uint32_t)(mode << n); /* Clear, then set bit. */ } int timer_expired(uint32_t *t, uint32_t prd, uint32_t now) @@ -71,7 +71,7 @@ void exti_pin_init(uint16_t pin, uint8_t rising, uint8_t priority, func_ptr hand volatile uint32_t *edge_selection = (&EXTI->FTSR - rising); /* Rising/falling edge. */ *edge_selection |= BIT(n); - SYSCFG->EXTICR[n / 4] |= PIN_BANK(pin) << ((n - (4 * (n / 4))) * 4); /* Set source input for respective EXTI line. */ + SYSCFG->EXTICR[n / 4] |= (uint32_t)(PIN_BANK(pin) << ((n - (4 * (n / 4))) * 4)); /* Set source input for respective EXTI line. */ uint8_t irq_pos = n < 2 ? EXTI0_1_IRQn : n < 4 ? EXTI2_3_IRQn : EXTI4_15_IRQn; NVIC_EnableIRQ(irq_pos); diff --git a/src/hal/hal.h b/src/hal/hal.h index 98ee7ce..cf5213d 100644 --- a/src/hal/hal.h +++ b/src/hal/hal.h @@ -21,8 +21,8 @@ #define BIT_LAST(x, y) (x & ((1UL << y) - 1)) /* Last y bits. */ /* uint16_t(2 bytes): upper byte = bank #, lower byte = pin # */ -#define PIN(bank, num) ((((bank) - 'A') << 8) | (num)) /* ex: PIN('C', 7) */ -#define PIN_NUM(pin) ((uint8_t)BIT_LAST(pin, 8)) +#define PIN(bank, num) (((uint16_t)((bank) - 'A') << 8UL) | (uint8_t)(num)) /* ex: PIN('C', 7) */ +#define PIN_NUM(pin) ((uint8_t)(BIT_LAST(pin, 8))) #define PIN_BANK(pin) ((uint8_t)((pin) >> 8)) /* GPIO input/output modes. */