From 5078b0bfafa7140e0ca3dd79f3bf35464f801682 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 22 Apr 2026 16:05:37 +1000 Subject: [PATCH 01/10] Fix multi-line comment in apb_timer/timer.c Gcc complains about a multi-line // comment. Fix it. Signed-off-by: Peter Chubb --- drivers/timer/apb_timer/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/timer/apb_timer/timer.c b/drivers/timer/apb_timer/timer.c index fd3d2379a..2d37e78e8 100644 --- a/drivers/timer/apb_timer/timer.c +++ b/drivers/timer/apb_timer/timer.c @@ -21,8 +21,8 @@ #define LOG_APBTIMER_ERR(...) do{ sddf_dprintf("APBTIMER|ERROR: "); sddf_dprintf(__VA_ARGS__); }while(0) -#define NUM_TIMERS 2 // Adjust if synthesised with more timers. \ - // Minimum = 2 due to a bug in the HDL, assumed for rest of this driver. +#define NUM_TIMERS 2 // Adjust if synthesised with more timers. + // Minimum = 2 due to a bug in the HDL, assumed for rest of this driver. #define APBTIMER_MAX_TICKS (UINT32_MAX) #define APBTIMER_CLK_FREQ ((uint64_t)50000000) // 50MHz #define NANO_INVERSE NS_IN_S From 7f958e5fae18caedbd57eb26472fc3e6d69393fd Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 22 Apr 2026 16:07:15 +1000 Subject: [PATCH 02/10] Remove unused variable in i2c/libi2c.c GCC complained about an unused variable: remove it. Signed-off-by: Peter Chubb --- i2c/libi2c.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/i2c/libi2c.c b/i2c/libi2c.c index f6713c847..c2bdc83d9 100644 --- a/i2c/libi2c.c +++ b/i2c/libi2c.c @@ -70,7 +70,6 @@ static int __i2c_dispatch(libi2c_conf_t *conf, i2c_addr_t address, void *buf, ui // Create header command i2c_cmd_t header; - i2c_err_t error = I2C_ERR_OK; header.flag_mask = I2C_FLAG_HEAD; header.payload.i2c_header.batch_len = num_batches; header.payload.i2c_header.address = address; @@ -103,7 +102,6 @@ static int __i2c_dispatch(libi2c_conf_t *conf, i2c_addr_t address, void *buf, ui // No need to clean up if we fail. We just surrender pending requests // and exit. LOG_LIBI2C_ERR("__i2c_dispatch failed to enqueue request!\n"); - error = -1; i2c_request_abort(*conf->handle); return -1; } From 0f02696340a2212f61337fc94e39fa608bf8f7d8 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 22 Apr 2026 16:26:11 +1000 Subject: [PATCH 03/10] Mark usdhc_debug as unused This means we can get of the -Wno-unused-function compiler arg that is unrecognised by GCC. Signed-off-by: Peter Chubb --- drivers/blk/mmc/imx/usdhc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/blk/mmc/imx/usdhc.c b/drivers/blk/mmc/imx/usdhc.c index 564124ed8..42365a563 100644 --- a/drivers/blk/mmc/imx/usdhc.c +++ b/drivers/blk/mmc/imx/usdhc.c @@ -176,7 +176,7 @@ static inline void clear_card_state(void) }; } -static inline void usdhc_debug(void) +__attribute__ ((unused)) static inline void usdhc_debug(void) { LOG_DRIVER("PRES_STATE: %u, PROT_CTRL: %u, SYS_CTRL: %u, MIX_CTRL: %u\n", usdhc_regs->pres_state, usdhc_regs->prot_ctrl, usdhc_regs->sys_ctrl, usdhc_regs->mix_ctrl); From 16062b3b34b2a08f817d7666af72d55b7522d17c Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 22 Apr 2026 16:28:17 +1000 Subject: [PATCH 04/10] Make sure things are rebuilt when they should be Extend the board-hash to include TOOLCHAIN and make it so *everything* depends on it. Make clang the default toolchain Allow parent Makefiles to add to the flags depended on. Signed-off-by: Peter Chubb --- tools/make/board/common.mk | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/make/board/common.mk b/tools/make/board/common.mk index 736d58618..9d6629803 100644 --- a/tools/make/board/common.mk +++ b/tools/make/board/common.mk @@ -24,12 +24,21 @@ endif ifeq ($(wildcard ${SDDF}/tools/make/board/${MICROKIT_BOARD}.mk),) $(error No Make snippet in ${SDDF}/tools/make/board for ${MICROKIT_BOARD}) endif +TOOLCHAIN ?= clang include ${SDDF}/tools/make/board/${MICROKIT_BOARD}.mk include ${SDDF}/tools/make/toolchain/${TOOLCHAIN}.mk MICROKIT_TOOL ?= $(MICROKIT_SDK)/bin/microkit +# For submakes +export SUPPORTED_BOARDS +export MICROKIT_BOARD +export MICROKIT_CONFIG +export BOARD_DIR +export MICROKIT_SDK +export TOOLCHAIN + ifneq ($(ARCH),x86_64) DTS := $(SDDF)/dts/$(MICROKIT_BOARD).dts DTB := $(MICROKIT_BOARD).dtb @@ -56,11 +65,20 @@ eth_driver.elf: ${ETH_DRIV} # Magic to ensure stuff gets recompiled if we change # board name, or use a different Microkit etc. -CHECK_FLAGS_BOARD_HASH := .board_cflags-$(shell echo -- ${CFLAGS} ${MICROKIT_SDK} ${MICROKIT_BOARD} ${MICROKIT_CONFIG} ${SMP_CONFIG} ${BENCH_PMU_EVENTS} | shasum | sed 's/ *-//g') + +COMMON_CONFIG += ${TOOLCHAIN} \ + ${CFLAGS} \ + ${MICROKIT_SDK} \ + ${MICROKIT_BOARD} \ + ${MICROKIT_CONFIG} \ + ${SMP_CONFIG} \ + ${BENCH_PMU_EVENTS} + +CHECK_FLAGS_BOARD_HASH := .board_cflags-$(shell echo -- ${COMMON_CONFIG} | \ + shasum | sed 's/ *-//g') ${CHECK_FLAGS_BOARD_HASH}: -rm -f .board_cflags-* touch $@ -REBUILD_CANDIDATE_OBJECTS := $(shell find . -name '*.o') -${REBUILD_CANDIDATE_OBJECTS): .EXTRA_PREREQS = ${CHECK_FLAGS_BOARD_HASH} +.EXTRA_PREREQS = ${CHECK_FLAGS_BOARD_HASH} From c42de5f468b6d2d3cf2bdf0321c28171cdb1bb7b Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 22 Apr 2026 16:30:19 +1000 Subject: [PATCH 05/10] Allow blk example to build with gcc or clang Extends flags with NVME and PARTITION so changing them forces a rebuild. Passes down Makefile flags to submake. Reformat slightly for clarity Signed-off-by: Peter Chubb --- examples/blk/Makefile | 2 +- examples/blk/blk.mk | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/examples/blk/Makefile b/examples/blk/Makefile index c7ef27cfa..8ffb8e7e2 100644 --- a/examples/blk/Makefile +++ b/examples/blk/Makefile @@ -23,7 +23,7 @@ REPORT_FILE := ${BUILD_DIR}/report.txt all: ${IMAGE_FILE} qemu ${IMAGE_FILE} ${REPORT_FILE} clean clobber: ${BUILD_DIR}/Makefile FORCE - ${MAKE} -C ${BUILD_DIR} MICROKIT_SDK=${MICROKIT_SDK} $(notdir $@) + ${MAKE} -C ${BUILD_DIR} -${MAKEFLAGS} $(notdir $@) ${BUILD_DIR}/Makefile: blk.mk mkdir -p ${BUILD_DIR} diff --git a/examples/blk/blk.mk b/examples/blk/blk.mk index 8ec2bedfd..a5752f309 100644 --- a/examples/blk/blk.mk +++ b/examples/blk/blk.mk @@ -41,20 +41,29 @@ SYSTEM_FILE := blk.system SUPPORTED_BOARDS := qemu_virt_aarch64 \ qemu_virt_riscv64 \ maaxboard \ - x86_64_generic + x86_64_generic TOP := ${SDDF}/examples/blk CONFIGS_INCLUDE := ${TOP} SDDF_CUSTOM_LIBC := 1 +# Force rebuild if partition or NVME args change +# This is probably too crude: it forces _everything_ to be rebuilt +COMMON_CONFIG += ${PARTITION} ${NVME} + include ${SDDF}/tools/make/board/common.mk -IMAGES := blk_driver.elf client.elf blk_virt.elf serial_virt_tx.elf serial_driver.elf -CFLAGS += -Wall -Wno-unused-function -Werror -Wno-unused-command-line-argument \ - -I$(SDDF)/include \ - -I$(SDDF)/include/microkit \ - -I$(CONFIGS_INCLUDE) +IMAGES := blk_driver.elf \ + client.elf \ + blk_virt.elf \ + serial_virt_tx.elf \ + serial_driver.elf + +CFLAGS += -Wall -Werror \ + -I$(SDDF)/include \ + -I$(SDDF)/include/microkit \ + -I$(CONFIGS_INCLUDE) LDFLAGS := -L$(BOARD_DIR)/lib LIBS := --start-group -lmicrokit -Tmicrokit.ld libsddf_util_debug.a --end-group From 1984d8153e7107e4163520777886727daebb1f4f Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 13 May 2026 08:33:56 +1000 Subject: [PATCH 06/10] Mark unused functions unused This allows compilation ... there are some debug print helper functions in a block.h header file. -- Mark them inline so they don't get expanded if not used -- Mark them __attribute__((unused) to make sure the compiler doesn't complain. Signed-off-by: Peter Chubb --- drivers/blk/virtio/block.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/blk/virtio/block.h b/drivers/blk/virtio/block.h index 93a9aae2b..ab18c4c28 100644 --- a/drivers/blk/virtio/block.h +++ b/drivers/blk/virtio/block.h @@ -104,7 +104,7 @@ static void virtio_blk_print_req(struct virtio_blk_req *req) req->type, req->reserved, req->sector, req->status); } -static void virtio_blk_print_config(volatile struct virtio_blk_config *config) +static inline void __attribute__((unused)) virtio_blk_print_config(volatile struct virtio_blk_config *config) { LOG_DRIVER("capacity: 0x%lx (0x%lx bytes)\n", config->capacity, config->capacity * VIRTIO_BLK_SECTOR_SIZE); LOG_DRIVER("size_max: 0x%x\n", config->size_max); @@ -130,7 +130,7 @@ static void virtio_blk_print_config(volatile struct virtio_blk_config *config) LOG_DRIVER("secure_erase_sector_alignment: 0x%x\n", config->secure_erase_sector_alignment); } -static void virtio_blk_print_features(uint64_t features) +static inline __attribute((unused)) void virtio_blk_print_features(uint64_t features) { if (features & ((uint64_t)1 << VIRTIO_BLK_F_SIZE_MAX)) { LOG_DRIVER(" VIRTIO_BLK_F_SIZE_MAX\n"); From 15d761516068971e393a9810c0fa5404ad494f9f Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 13 May 2026 08:41:41 +1000 Subject: [PATCH 07/10] Whitespace only changes in timer.c to make the style checker happy. Signed-off-by: Peter Chubb --- drivers/timer/apb_timer/timer.c | 108 +++++++++++++++++++------------- 1 file changed, 66 insertions(+), 42 deletions(-) diff --git a/drivers/timer/apb_timer/timer.c b/drivers/timer/apb_timer/timer.c index 2d37e78e8..bd4c48b1f 100644 --- a/drivers/timer/apb_timer/timer.c +++ b/drivers/timer/apb_timer/timer.c @@ -21,23 +21,37 @@ #define LOG_APBTIMER_ERR(...) do{ sddf_dprintf("APBTIMER|ERROR: "); sddf_dprintf(__VA_ARGS__); }while(0) -#define NUM_TIMERS 2 // Adjust if synthesised with more timers. - // Minimum = 2 due to a bug in the HDL, assumed for rest of this driver. +/* + * Adjust NUM_TIMERS if synthesised with more timers. + * Minimum = 2 due to a bug in the HDL, assumed for rest + * of this driver. + */ +#define NUM_TIMERS 2 #define APBTIMER_MAX_TICKS (UINT32_MAX) #define APBTIMER_CLK_FREQ ((uint64_t)50000000) // 50MHz #define NANO_INVERSE NS_IN_S -// The APB timer has an array of internal timers. Use one for long-running time measurements, use -// the other for generating interrupts at finer granularity using prescalers. -// TODO: support >2 timers; probably exposed over a different API for drivers etc? +/* + * The APB timer has an array of internal timers. Use one for + * long-running time measurements, use the other for generating + * interrupts at finer granularity using prescalers. + * + * TODO: support >2 timers; probably exposed over a different API for + * drivers etc? + */ #define TIMER_TIMEOUT (0) -// We are conservative with IRQs in config.json. We don't use the 2nd (cmp) interrupt -// for the timekeeper, and since that IRQ isn't in config.json we must make sure the timekeeper -// is the last ID to avoid accessing the wrong IRQ. +/* + * We are conservative with IRQs in config.json. We don't use the 2nd + * (cmp) interrupt for the timekeeper, and since that IRQ isn't in + * config.json we must make sure the timekeeper is the last ID to + * avoid accessing the wrong IRQ. + */ #define TIMER_TIMEKEEPER (1) -// NOTE: at the time of writing, the APB timer's prescaler logic is completely -// broken. We use no prescaler as a result. +/* + * NOTE: at the time of writing, the APB timer's prescaler logic is + * completely broken. We use no prescaler as a result. + */ #define TIMEKEEPER_PRESCALER (0) #define APBTIMER_CTRL_EN_BIT (BIT(0)) @@ -52,7 +66,10 @@ __attribute__((__section__(".device_resources"))) device_resources_t device_resources; -// Timer block implements NUM_TIMERS separate timers with back-to-back registers +/* + * Timer block implements NUM_TIMERS separate timers with back-to-back + * registers + */ struct timer_regs { uint32_t timer; uint32_t ctrl; @@ -63,7 +80,8 @@ struct timer_regs { // Array of regs structs, not just one set! volatile struct timer_regs *regs; -/* Keep track of how many timer overflows have occured. +/* + * Keep track of how many timer overflows have occured. * Used as the most significant segment of ticks. * We need to keep track of this state as the value register is only * 32 bits as opposed to the common 64 bit timer value regsiters found @@ -80,11 +98,12 @@ typedef struct apbtimer_timeout_conf { } apbtimer_timeout_conf_t; /** - * Convert the tick count of a timer to nanoseconds, given the expected prescaler - * and overflow counter. Prescaler can be set to 0 to ignore. + * Convert the tick count of a timer to nanoseconds, given the + * expected prescaler and overflow counter. Prescaler can be set to 0 + * to ignore. * - * Prescaler should be given in same format as ctrl reg - i.e. 0 = disabled (multiply - * by 1), 1 = multiply by 2, etc. + * Prescaler should be given in same format as ctrl reg - i.e. 0 = + * disabled (multiply by 1), 1 = multiply by 2, etc. */ static inline uint64_t tick_to_ns(uint64_t ticks, uint64_t prescaler) { @@ -99,8 +118,8 @@ static inline uint64_t tick_to_ns(uint64_t ticks, uint64_t prescaler) /** * Return number of ticks since driver startup using timekeeper timer. - * NOTE: one round of timer @ 50MHz with prescaler of (1<<3)=4 lasts for 171.8 - * seconds. Time resolution = 80ns per tick. + * NOTE: one round of timer @ 50MHz with prescaler of (1<<3)=4 lasts + * for 171.8 seconds. Time resolution = 80ns per tick. */ static uint64_t get_time_ns(void) { @@ -112,27 +131,32 @@ static uint64_t get_time_ns(void) } /** - * Calculate the cmp value and prescaler for the timeout timer given - * a desired delay in nanoseconds. If delay exceeds capacity of timer, + * Calculate the cmp value and prescaler for the timeout timer given a + * desired delay in nanoseconds. If delay exceeds capacity of timer, * returns maximum prescaler and cmp. */ static apbtimer_timeout_conf_t calculate_timeout_from_ns(uint64_t ns_delay) { - // Convert nanoseconds to ticks with a prescaler of zero (x1) - // tick = 1 timer period = 1/f_clk = T_clk - // ticks = n. periods in delay = seconds_delay / T_clk - // - // To get ticks efficiently, precalculate 1/nano (10e-9). - // Hence, T_clk = NANO_INVERSE / F_clk - // and T_delay = seconds_delay / (NANO_INVERSE/F_clk) - // uint64_t divisor = NANO_INVERSE / APBTIMER_CLK_FREQ; - // uint64_t ticks = ns_delay / divisor; + /* + * Convert nanoseconds to ticks with a prescaler of zero (x1) + * tick = 1 timer period = 1/f_clk = T_clk + * ticks = n. periods in delay = seconds_delay / T_clk + * + * To get ticks efficiently, precalculate 1/nano (10e-9). + * Hence, T_clk = NANO_INVERSE / F_clk + * and T_delay = seconds_delay / (NANO_INVERSE/F_clk) + * uint64_t divisor = NANO_INVERSE / APBTIMER_CLK_FREQ; + * uint64_t ticks = ns_delay / divisor; + */ uint64_t ticks = (ns_delay * APBTIMER_CLK_FREQ) / NANO_INVERSE; uint32_t prescaler = 0; uint32_t cmp = ticks; - // NOTE: at the time of writing, the APB timer's prescaler logic is completely - // broken. The prescaler calculator is disabled as a result. + /* + * NOTE: at the time of writing, the APB timer's prescaler logic + * is completely broken. The prescaler calculator is disabled as a + * result. + */ // if (ticks <= UINT32_MAX) { // // No prescaler needed @@ -170,9 +194,9 @@ static inline void set_timeout_prescaler(uint8_t prescaler) } /** - * Set up timekeeper timer for timestamping execution. - * Use maximum prescaler, disable cmp interrupts to minimise performance - * impact from timeouts. + * Set up timekeeper timer for timestamping execution. Use maximum + * prescaler, disable cmp interrupts to minimise performance impact + * from timeouts. */ static inline void setup_timekeeper(void) { @@ -197,15 +221,15 @@ static inline void timeout_set_enable(bool enable) } /** - * Process timeouts from the queue using the timeout timer. - * This *differs* from most other sDDF timers because we process timeouts - * on a relative basis rather than with respect to the absolute time, as such - * a method is cumbersome and inefficient with 32 bit timers. + * Process timeouts from the queue using the timeout timer. This + * *differs* from most other sDDF timers because we process timeouts + * on a relative basis rather than with respect to the absolute time, + * as such a method is cumbersome and inefficient with 32 bit timers. * - * Timeouts are stored using absolute time upon PPC, this function converts the - * next timeout into a relative stamp from the current time and awaits it using - * the timeout timer. Automatically sets prescaler to satisfy most granular time - * resolution. + * Timeouts are stored using absolute time upon PPC, this function + * converts the next timeout into a relative stamp from the current + * time and awaits it using the timeout timer. Automatically sets + * prescaler to satisfy most granular time resolution. */ static void process_timeouts(void) { From 1a305915a8273f5b723ca26fed28ecaddafcad75 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 13 May 2026 08:43:26 +1000 Subject: [PATCH 08/10] Delete unused function in mmio.c -- clang complains about unused functions. Signed-off-by: Peter Chubb --- virtio/transport/mmio.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/virtio/transport/mmio.c b/virtio/transport/mmio.c index 92b69dcac..2cc45488f 100644 --- a/virtio/transport/mmio.c +++ b/virtio/transport/mmio.c @@ -12,11 +12,6 @@ static bool check_magic(virtio_mmio_regs_t *regs) return regs->MagicValue == 0x74726976; } -static bool check_device_id(virtio_mmio_regs_t *regs, virtio_device_id_t id) -{ - return regs->DeviceID == id; -} - static uint32_t get_version(virtio_mmio_regs_t *regs) { return regs->Version; @@ -137,4 +132,4 @@ void virtio_transport_write_isr(virtio_device_handle_t *device_handle, uint32_t volatile virtio_mmio_regs_t *regs = get_regs(device_handle->device_resources); regs->InterruptACK = isr; -} \ No newline at end of file +} From 2bb2ae4f2ec822da17c32be14f0b02ee9a2744dc Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Wed, 13 May 2026 08:44:34 +1000 Subject: [PATCH 09/10] Whitespace only fixes Fix style in timer/apb_timer/timer.c blk/mmc/imx/usdhc.c and Makefiles Signed-off-by: Peter Chubb --- drivers/blk/mmc/imx/usdhc.c | 318 ++++++++++++++++++-------------- drivers/timer/apb_timer/timer.c | 2 +- tools/make/board/common.mk | 2 +- 3 files changed, 177 insertions(+), 145 deletions(-) diff --git a/drivers/blk/mmc/imx/usdhc.c b/drivers/blk/mmc/imx/usdhc.c index 42365a563..2e4d64d93 100644 --- a/drivers/blk/mmc/imx/usdhc.c +++ b/drivers/blk/mmc/imx/usdhc.c @@ -176,14 +176,14 @@ static inline void clear_card_state(void) }; } -__attribute__ ((unused)) static inline void usdhc_debug(void) +__attribute__((unused)) static inline void usdhc_debug(void) { - LOG_DRIVER("PRES_STATE: %u, PROT_CTRL: %u, SYS_CTRL: %u, MIX_CTRL: %u\n", usdhc_regs->pres_state, usdhc_regs->prot_ctrl, - usdhc_regs->sys_ctrl, usdhc_regs->mix_ctrl); + LOG_DRIVER("PRES_STATE: %u, PROT_CTRL: %u, SYS_CTRL: %u, MIX_CTRL: %u\n", usdhc_regs->pres_state, + usdhc_regs->prot_ctrl, usdhc_regs->sys_ctrl, usdhc_regs->mix_ctrl); LOG_DRIVER("CMD_RSP0: %u, CMD_RSP1: %u, CMD_RSP2: %u, CMD_RSP3: %u\n", usdhc_regs->cmd_rsp0, usdhc_regs->cmd_rsp1, usdhc_regs->cmd_rsp2, usdhc_regs->cmd_rsp3); - LOG_DRIVER("INT_STATUS: %u, INT_STATUS_EN: %u, INT_SIGNAL_EN: %u\n", usdhc_regs->int_status, usdhc_regs->int_status_en, - usdhc_regs->int_signal_en); + LOG_DRIVER("INT_STATUS: %u, INT_STATUS_EN: %u, INT_SIGNAL_EN: %u\n", usdhc_regs->int_status, + usdhc_regs->int_status_en, usdhc_regs->int_signal_en); LOG_DRIVER("VEND_SPEC: %u, VEND_SPEC2: %u, BLK_ATT: %u\n", usdhc_regs->vend_spec, usdhc_regs->vend_spec2, usdhc_regs->blk_att); } @@ -197,8 +197,10 @@ static uint32_t get_command_xfr_typ(sd_cmd_t cmd) cmd_xfr_typ |= USDHC_CMD_XFR_TYP_DPSEL; } - /* [IMX8MDQLQRM] Table 10-42. Relationship between parameters and the name of the response type - * Note that R7 doesn't exist in the table but is essentially just R1. + /* + * [IMX8MDQLQRM] Table 10-42. Relationship between parameters and + * the name of the response type. Note that R7 doesn't exist in the + * table but is essentially just R1. */ switch (cmd.cmd_response_type) { case RespType_None: @@ -206,8 +208,7 @@ static uint32_t get_command_xfr_typ(sd_cmd_t cmd) break; case RespType_R2: - cmd_xfr_typ |= USDHC_CMD_XFR_TYP_CCCEN \ - | (USDHC_CMD_XFR_TYP_RSPTYP_L136 << USDHC_CMD_XFR_TYP_RSPTYP_SHIFT); + cmd_xfr_typ |= USDHC_CMD_XFR_TYP_CCCEN | (USDHC_CMD_XFR_TYP_RSPTYP_L136 << USDHC_CMD_XFR_TYP_RSPTYP_SHIFT); break; case RespType_R3: @@ -219,13 +220,13 @@ static uint32_t get_command_xfr_typ(sd_cmd_t cmd) case RespType_R5: case RespType_R6: case RespType_R7: - cmd_xfr_typ |= USHDC_CMD_XFR_TYP_CICEN | USDHC_CMD_XFR_TYP_CCCEN \ - | (USDHC_CMD_XFR_TYP_RSPTYP_L48 << USDHC_CMD_XFR_TYP_RSPTYP_SHIFT); + cmd_xfr_typ |= USHDC_CMD_XFR_TYP_CICEN | USDHC_CMD_XFR_TYP_CCCEN + | (USDHC_CMD_XFR_TYP_RSPTYP_L48 << USDHC_CMD_XFR_TYP_RSPTYP_SHIFT); break; case RespType_R1b: - cmd_xfr_typ |= USHDC_CMD_XFR_TYP_CICEN | USDHC_CMD_XFR_TYP_CCCEN \ - | (USDHC_CMD_XFR_TYP_RSPTYP_L48B << USDHC_CMD_XFR_TYP_RSPTYP_SHIFT); + cmd_xfr_typ |= USHDC_CMD_XFR_TYP_CICEN | USDHC_CMD_XFR_TYP_CCCEN + | (USDHC_CMD_XFR_TYP_RSPTYP_L48B << USDHC_CMD_XFR_TYP_RSPTYP_SHIFT); break; default: @@ -241,7 +242,10 @@ static blk_resp_status_t drv_to_blk_status(drv_status_t status) case DrvSuccess: return BLK_RESP_OK; - /* TODO: Make this error more specific once we implemented SD error recovery */ + /* + * TODO: Make this error more specific once we implemented SD + * error recovery + */ case DrvErrorInternal: return BLK_RESP_ERR_UNSPEC; @@ -268,35 +272,43 @@ static bool card_detected(void) static drv_status_t handle_interrupt_status(sd_cmd_t cmd) { - /* Important Note: INT_STATUS register is of the W1C (write 1 to clear) type */ + /* + * Important Note: INT_STATUS register is of the W1C (write 1 to + * clear) type + */ uint32_t int_status = usdhc_regs->int_status; /* If any bits aside from Command Complete / Transfer Complete are set... */ if (int_status & ~(USDHC_INT_STATUS_CC | USDHC_INT_STATUS_TC)) { /* [IMX8MDQLQRM] Tables 10-44, 10-45, 10-46. - - TODO: Map the specific errors to something sensible. - TODO: Run the RST_C / RST_D to reset the comamnd/ data inhibit? - & Follow the proper [SD-HOST] error handling flow. - - NOTE: As we don't do this, any errors cause the driver to - continuously error with 'Could not send a command as CMD/DATA-inhibit - fields were set' for any further commands. + * + * TODO: Map the specific errors to something sensible. + * TODO: Run the RST_C / RST_D to reset the comamnd/ data inhibit? + * & Follow the proper [SD-HOST] error handling flow. + * + * NOTE: As we don't do this, any errors cause the driver to + * continuously error with 'Could not send a command as + * CMD/DATA-inhibit fields were set' for any further + * commands. */ LOG_DRIVER("-> received error response\n"); if (int_status & USDHC_INT_STATUS_DMAE) { - /* DMA error ==> probably a virtualiser error because of an - incorrect memory address. */ + /* + * DMA error ==> probably a virtualiser error because of + * an incorrect memory address. + */ LOG_DRIVER_ERR("DMA error encountered: DS_ADDR: 0x%x\n", usdhc_regs->ds_addr); } usdhc_regs->int_status = 0xffffffff; if (!card_detected()) { - /* If the card isn't detected, the error is because of that - ... don't do anything with this aside from return an error, - though, as this is the wrong layer for that to make sense */ + /* + * If the card isn't detected, the error is because of that + * ... don't do anything with this aside from return an error, + * though, as this is the wrong layer for that to make sense + */ return DrvErrorCardGone; } @@ -318,17 +330,19 @@ static drv_status_t handle_interrupt_status(sd_cmd_t cmd) } /* - [SD-HOST] 2.2.18 Normal Interrupt Status Register states that - - Transfer Complete - This bit indicates stop of transaction on three cases: - (1) Completion of data transfer - (2) Completion of a command pairing with response-with-busy (R1b, R5b) - - [IMX8MDQLQRM] INT_STATUS for TC bit also indicates similarly... - - However, we never get transfer complete interrupts for response-with-busy. - */ + * [SD-HOST] 2.2.18 Normal Interrupt Status Register states that + * + * Transfer Complete + * This bit indicates stop of transaction on three cases: + * (1) Completion of data transfer + * (2) Completion of a command pairing with response-with- + * busy (R1b, R5b) + * + * [IMX8MDQLQRM] INT_STATUS for TC bit also indicates similarly... + * + * However, we never get transfer complete interrupts for + * response-with-busy. + */ if (transfer_complete) { usdhc_regs->int_status = USDHC_INT_STATUS_TC; @@ -350,8 +364,9 @@ drv_status_t send_command_inner(command_state_t *state, sd_cmd_t cmd, uint32_t c switch (*state) { case SendStateInit: /* [IMX8MDQLQRM] 10.3.7.1.5 Command Transfer Type - * The host driver checks the Command Inhibit DAT field (PRES_STATE[CDIHB]) and - * the \Command Inhibit CMD field (PRES_STATE[CIHB]) in the Present State register + * The host driver checks the Command Inhibit DAT field + * (PRES_STATE[CDIHB]) and the \Command Inhibit CMD field + * (PRES_STATE[CIHB]) in the Present State register * before writing to this register. * * There seems to be an issue with this IMX8 uSDHC device, where even @@ -384,9 +399,9 @@ drv_status_t send_command_inner(command_state_t *state, sd_cmd_t cmd, uint32_t c case SendStateSend: cmd_xfr_typ = get_command_xfr_typ(cmd); - LOG_DRIVER("Running %s%2u; argument=0x%08x; cmd_xfr_typ=0x%08x; data_present=%s\n", - cmd.is_app_cmd ? "ACMD" : " CMD", - cmd.cmd_index, cmd_arg, cmd_xfr_typ, + LOG_DRIVER("Running %s%2u; argument=0x%08x; cmd_xfr_typ=0x%08x; " + "data_present=%s\n", + cmd.is_app_cmd ? "ACMD" : " CMD", cmd.cmd_index, cmd_arg, cmd_xfr_typ, cmd.data_present ? "yes" : "no"); usdhc_regs->cmd_arg = cmd_arg; @@ -518,14 +533,15 @@ void wait_clock_stable() */ void usdhc_change_clock_frequency(sd_clock_freq_t frequency) { - /* [IMX8MDQLQRM] Section 10.3.6.7 Changing clock frequency - > To prevent possible glitch on the card clock, clear the FRC_SDCLK_ON - > bit when changing the clock divisor value (SDCLKFS or DVS in - > System Control Register) or [...]. - > - > Also, before changing the clock divisor value, the host driver should - > make sure that the SDSTB bit is high. - */ + /* + * [IMX8MDQLQRM] Section 10.3.6.7 Changing clock frequency + * > To prevent possible glitch on the card clock, clear the FRC_SDCLK_ON + * > bit when changing the clock divisor value (SDCLKFS or DVS in + * > System Control Register) or [...]. + * > + * > Also, before changing the clock divisor value, the host driver should + * > make sure that the SDSTB bit is high. + */ usdhc_regs->vend_spec &= ~USDHC_VEND_SPEC_FRC_SDCLK_ON; wait_clock_stable(); @@ -540,17 +556,19 @@ void usdhc_setup_clock() usdhc_change_clock_frequency(ClockSpeedIdentify_400KHz); } -/* - Reset the uSDHC (SD Host Controller), bringing all cards back to the idle State. - - Ref: [IMX8MDQLQRM] Section 10.3.4.2.2 Reset -*/ +/** + * Reset the uSDHC (SD Host Controller), bringing all cards back to + * the idle State. + * + * Ref: [IMX8MDQLQRM] Section 10.3.4.2.2 Reset + */ void usdhc_reset(void) { - /* [IMX8MDQLQRM] Section 10.3.6.7 Changing clock frequency - > To prevent possible glitch on the card clock, clear the FRC_SDCLK_ON - > bit when changing [...] or setting the RSTA bit. - */ + /* + * [IMX8MDQLQRM] Section 10.3.6.7 Changing clock frequency + * > To prevent possible glitch on the card clock, clear the FRC_SDCLK_ON + * > bit when changing [...] or setting the RSTA bit. + */ usdhc_regs->vend_spec &= ~USDHC_VEND_SPEC_FRC_SDCLK_ON; /* Software reset for all; wait until it self-clears */ @@ -559,13 +577,14 @@ void usdhc_reset(void) usdhc_setup_clock(); - /* Wait 74 (~80) clock ticks for power up as required by the spec. - - [IMX8MDQLQRM] 10.3.7.1.13 System Control: - > INITA / Field 27 can only be set when CIHB & CDIHB fields are unset. - - At this stage, there should be no commands happening... - */ + /* + * Wait 74 (~80) clock ticks for power up as required by the spec. + * + * [IMX8MDQLQRM] 10.3.7.1.13 System Control: + * > INITA / Field 27 can only be set when CIHB & CDIHB fields are unset. + * + * At this stage, there should be no commands happening... + */ assert(!(usdhc_regs->pres_state & (USDHC_PRES_STATE_CIHB | USDHC_PRES_STATE_CDIHB))); usdhc_regs->sys_ctrl |= USDHC_SYS_CTRL_INITA; while (!(usdhc_regs->sys_ctrl & USDHC_SYS_CTRL_INITA)); @@ -574,28 +593,29 @@ void usdhc_reset(void) usdhc_regs->int_status_en = INT_STATUSES_ENABLED; usdhc_regs->int_signal_en = INT_SIGNALS_ENABLED; - /* Following [1] and [2], we set several registers that are not cleared - after software reset. + /* + * Following [1] and [2], we set several registers that are not cleared + * after software reset. - [1]: https://github.com/BarrelfishOS/barrelfish/blob/master/usr/drivers/imx8x/sdhc/sdhc.c#L166-L175 - [2]: https://github.com/u-boot/u-boot/blob/v2024.07/drivers/mmc/fsl_esdhc_imx.c#L999-L1015 - */ + * [1]: https://github.com/BarrelfishOS/barrelfish/blob/master/usr/drivers/imx8x/sdhc/sdhc.c#L166-L175 + * [2]: https://github.com/u-boot/u-boot/blob/v2024.07/drivers/mmc/fsl_esdhc_imx.c#L999-L1015 + */ usdhc_regs->mmc_boot = 0; usdhc_regs->clk_tune_ctrl_status = 0; usdhc_regs->dll_ctrl = 0; /* Enable DMA, Auto-CMD12 */ - usdhc_regs->mix_ctrl = USDHC_MIX_CTRL_DMAEN | USDHC_MIX_CTRL_AC12EN \ - /* Do multi-block transfers (impl detail: we always do) */ - | USDHC_MIX_CTRL_MSBSEL | USDHC_MIX_CTRL_BCEN; + usdhc_regs->mix_ctrl = USDHC_MIX_CTRL_DMAEN + | USDHC_MIX_CTRL_AC12EN /* Do multi-block transfers (impl detail: we always do) */ + | USDHC_MIX_CTRL_MSBSEL | USDHC_MIX_CTRL_BCEN; /* Again following [1] and [2] we configure various registers to good values */ // TODO(#187): UBoot sets these to blocksize/4 on each data command // => this is just arbitrarily set to 1 here. What are good values? usdhc_regs->wtmk_lvl = (0x01 << 16) | (0x01); usdhc_regs->prot_ctrl = (USDHC_PROT_CTRL_DTW_1_BIT << USDHC_PROT_CTRL_DTW_SHIFT) - | (USDHC_PROT_CTRL_EMODE_LITTLE << USDHC_PROT_CTRL_EMODE_SHIFT) - | (USDHC_PROT_CTRL_DMASEL_SIMPLE << USDHC_PROT_CTRL_DMASEL_SHIFT); + | (USDHC_PROT_CTRL_EMODE_LITTLE << USDHC_PROT_CTRL_EMODE_SHIFT) + | (USDHC_PROT_CTRL_DMASEL_SIMPLE << USDHC_PROT_CTRL_DMASEL_SHIFT); // TODO(#187): Probably should set up VEND_SPEC as desired...? } @@ -611,17 +631,20 @@ static void read_r2_response(uint32_t response[4]) response[3] = (usdhc_regs->cmd_rsp0 << 8); } -/* [SD-PHY] Section 4.2 Card Identification Mode. Following the flowcharts of - - Figure 4-1: SD Memory Card State Diagram (card identification mode) - - Figure 4-2: Card Initialization and Identification Flow (SD Mode) -*/ +/** + * [SD-PHY] Section 4.2 Card Identification Mode. Following the flowcharts of + * - Figure 4-1: SD Memory Card State Diagram (card identification mode) + * - Figure 4-2: Card Initialization and Identification Flow (SD Mode) + */ drv_status_t perform_card_identification_and_select() { drv_status_t status; switch (driver_state.card_ident) { case CardIdentStateInit: - /* [SD-PHY] Section 4.21.5 Pre-init mode - => we now exit this mode and move to idle */ + /* + * [SD-PHY] Section 4.21.5 Pre-init mode + * => we now exit this mode and move to idle + */ status = send_command(SD_CMD0_GO_IDLE_STATE, 0x0); if (status == DrvIrqWait) { return DrvIrqWait; @@ -635,12 +658,13 @@ drv_status_t perform_card_identification_and_select() fallthrough; case CardIdentStateIfCond: - /* [SD-PHY] Section 4.3.13 Send Interface Condition Command - > [19:16] Voltage supplied (VHS) from Table 4-18 - > [15:8 ] Check pattern to any 8-bit pattern. - */ - status = send_command(SD_CMD8_SEND_IF_COND, - (SD_IF_COND_VHS27_36 << SD_IF_COND_VHS_SHIFT) | (IF_COND_CHECK_PATTERN << SD_IF_COND_CHECK_SHIFT)); + /* + * [SD-PHY] Section 4.3.13 Send Interface Condition Command + * > [19:16] Voltage supplied (VHS) from Table 4-18 + * > [15:8 ] Check pattern to any 8-bit pattern. + */ + status = send_command(SD_CMD8_SEND_IF_COND, (SD_IF_COND_VHS27_36 << SD_IF_COND_VHS_SHIFT) + | (IF_COND_CHECK_PATTERN << SD_IF_COND_CHECK_SHIFT)); if (status == DrvIrqWait) { return DrvIrqWait; } @@ -650,15 +674,17 @@ drv_status_t perform_card_identification_and_select() return DrvErrorCardGone; } else if (status != DrvSuccess) { /* TODO: Unhandled card type. */ - LOG_DRIVER_ERR("Ver 1.X SD Card, or Ver2.00 with voltage mismatch not supported\n"); + LOG_DRIVER_ERR("Ver 1.X SD Card, or Ver2.00 with voltage mismatch " + "not supported\n"); return DrvErrorCardIncompatible; } uint32_t r7_resp = usdhc_regs->cmd_rsp0; /* [SD-PHY] 4.2.2 Operating Condition Validation - > If the card can operate on the supplied voltage, the response echoes - > back the supply voltage and the check pattern that were set in the command argument. - */ + * > If the card can operate on the supplied voltage, the response echoes + * > back the supply voltage and the check pattern that were + * > set in the command argument. + */ if (((r7_resp & SD_IF_COND_VHS_MASK) >> SD_IF_COND_VHS_SHIFT) != SD_IF_COND_VHS27_36) { LOG_DRIVER_ERR("CMD8: Non-compatible voltage range\n"); return DrvErrorCardIncompatible; @@ -672,12 +698,13 @@ drv_status_t perform_card_identification_and_select() fallthrough; case CardIdentStateOpCondInquiry: - /* [SD-PHY] 4.2.3.1 Initialization Command - > If the voltage window field (bit 23-0) in the argument is set - > to zero, it is called "inquiry CMD41" that does not start - > initialization and is use for getting OCR. The inquiry ACMD41 - > shall ignore the other field (bit 31-24) in the argument. - */ + /* + * [SD-PHY] 4.2.3.1 Initialization Command + * > If the voltage window field (bit 23-0) in the argument is set + * > to zero, it is called "inquiry CMD41" that does not start + * > initialization and is use for getting OCR. The inquiry ACMD41 + * > shall ignore the other field (bit 31-24) in the argument. + */ status = send_command(SD_ACMD41_SD_SEND_OP_COND, 0x0); if (status == DrvIrqWait) { return DrvIrqWait; @@ -700,29 +727,34 @@ drv_status_t perform_card_identification_and_select() fallthrough; case CardIdentStateOpCond: - /* [SD-PHY] 4.2.3.1 Initialization Command - > If the voltage window field (bit 23-0) in the argument is set to - > non-zero at the first time, it is called "first ACMD41" that starts - > initialization. The other field (bit 31-24) in the argument is effective. - > - > The argument of following ACMD41 shall be the same as that of the first ACMD41. - > - > The HCS (Host Capacity Support) bit set to 1 indicates that the - > host supports SDHC or SDXC Card. The HCS (Host Capacity Support) - > bit set to 0 indicates that the host supports neither SDHC nor SDXC Card. - > If HCS is set to 0, SDHC and SDXC Cards never return ready status. - > - > The host shall set ACMD41 timeout more than 1 second to abort repeat of - > issuing ACMD41 when the card does not indicate ready. The timeout count - > starts from the first ACMD41 which is set voltage window in the argument. - */ + /* + * [SD-PHY] 4.2.3.1 Initialization Command + * > If the voltage window field (bit 23-0) in the argument is set to + * > non-zero at the first time, it is called "first ACMD41" + * > that starts initialization. The other field (bit 31-24) + * > in the argument is effective. + * + * > The argument of following ACMD41 shall be the same as + * > that of the first ACMD41. + * > + * > The HCS (Host Capacity Support) bit set to 1 indicates that the + * > host supports SDHC or SDXC Card. The HCS (Host Capacity Support) + * > bit set to 0 indicates that the host supports neither + * > SDHC nor SDXC Card. + * > If HCS is set to 0, SDHC and SDXC Cards never return + * > ready status. + * + * > The host shall set ACMD41 timeout more than 1 second to + * > abort repeat of issuing ACMD41 when the card does not + * > indicate ready. The timeout count starts from the first + * > ACMD41 which is set voltage window in the argument. + */ if (driver_state.card_init_start_time == DRIVER_STATE_INIT) { driver_state.card_init_start_time = sddf_timer_time_now(timer_config.driver_id); } do { - status = send_command(SD_ACMD41_SD_SEND_OP_COND, - SD_OCR_HCS | SD_OCR_VDD31_32 | SD_OCR_VDD32_33); + status = send_command(SD_ACMD41_SD_SEND_OP_COND, SD_OCR_HCS | SD_OCR_VDD31_32 | SD_OCR_VDD32_33); if (status == DrvIrqWait) { return DrvIrqWait; } @@ -789,7 +821,8 @@ drv_status_t perform_card_identification_and_select() fallthrough; case CardIdentStateFrequencyChange: - /* [SD-PHY] 4.3 Data Transfer Mode + /* + * [SD-PHY] 4.3 Data Transfer Mode * > In Data Transfer Mode the host may operate the card in f_PP frequency range. */ usdhc_change_clock_frequency(ClockSpeedDefaultSpeed_25MHz); @@ -835,19 +868,20 @@ drv_status_t perform_card_identification_and_select() } } -/* [IMX8MDQLQRM] 10.3.4.3.2.1 Normal read - - 1. Wait until the card is ready for data - 2. Set the block length with SET_BLOCKLEN - 3. Set the uSDHC block length register - 4. Set the uSDHC number block register - 5. a. Disable the buffer read ready interrupt, configure the DMA settings - b. enable the uSDHC DMA when sending the command with data transfer - c. The AC12EN bit should also be set. - 6. Wait for the Transfer Complete interrupt. - - Also reference [SD-PHY] 4.3.3 Data Read. -*/ +/** + * [IMX8MDQLQRM] 10.3.4.3.2.1 Normal read + * + * 1. Wait until the card is ready for data + * 2. Set the block length with SET_BLOCKLEN + * 3. Set the uSDHC block length register + * 4. Set the uSDHC number block register + * 5. a. Disable the buffer read ready interrupt, configure the DMA settings + * b. enable the uSDHC DMA when sending the command with data transfer + * c. The AC12EN bit should also be set. + * 6. Wait for the Transfer Complete interrupt. + * + * Also reference [SD-PHY] 4.3.3 Data Read. + */ drv_status_t usdhc_read_blocks(uintptr_t dma_address, uint32_t sector_number, uint16_t sector_count) { drv_status_t status; @@ -864,8 +898,8 @@ drv_status_t usdhc_read_blocks(uintptr_t dma_address, uint32_t sector_number, ui return status; } - usdhc_regs->blk_att = (usdhc_regs->blk_att & ~USDHC_BLK_ATT_BLKSIZE_MASK) | (SD_BLOCK_SIZE << - USDHC_BLK_ATT_BLKSIZE_SHIFT); + usdhc_regs->blk_att = (usdhc_regs->blk_att & ~USDHC_BLK_ATT_BLKSIZE_MASK) + | (SD_BLOCK_SIZE << USDHC_BLK_ATT_BLKSIZE_SHIFT); usdhc_regs->ds_addr = dma_address; @@ -937,8 +971,8 @@ drv_status_t usdhc_write_blocks(uintptr_t dma_address, uint32_t sector_number, u return status; } - usdhc_regs->blk_att = (usdhc_regs->blk_att & ~USDHC_BLK_ATT_BLKSIZE_MASK) | (SD_BLOCK_SIZE << - USDHC_BLK_ATT_BLKSIZE_SHIFT); + usdhc_regs->blk_att = (usdhc_regs->blk_att & ~USDHC_BLK_ATT_BLKSIZE_MASK) + | (SD_BLOCK_SIZE << USDHC_BLK_ATT_BLKSIZE_SHIFT); usdhc_regs->ds_addr = dma_address; @@ -991,13 +1025,10 @@ void setup_blk_storage_info() // storage_info->read_only = /* TODO(#187): look at write protect flag */ storage_info->block_size = 1; - __uint128_t csd = ((__uint128_t)card_info.csd[0] << 96) - | ((__uint128_t)card_info.csd[1] << 64) - | ((__uint128_t)card_info.csd[2] << 32) - | ((__uint128_t)card_info.csd[3] << 0); + __uint128_t csd = ((__uint128_t)card_info.csd[0] << 96) | ((__uint128_t)card_info.csd[1] << 64) + | ((__uint128_t)card_info.csd[2] << 32) | ((__uint128_t)card_info.csd[3] << 0); - LOG_DRIVER("CSD Version: %x\n", - (uint32_t)((csd & SD_CSD_CSD_STRUCTURE_MASK) >> SD_CSD_CSD_STRUCTURE_SHIFT)); + LOG_DRIVER("CSD Version: %x\n", (uint32_t)((csd & SD_CSD_CSD_STRUCTURE_MASK) >> SD_CSD_CSD_STRUCTURE_SHIFT)); /* [SD-PHY] 5.3.1 CSD Structure specifies the version. */ switch ((csd & SD_CSD_CSD_STRUCTURE_MASK) >> SD_CSD_CSD_STRUCTURE_SHIFT) { @@ -1151,7 +1182,8 @@ void handle_client(bool was_irq) } driver_state.blk_req.inflight = true; - LOG_DRIVER("Received command: code=%d, paddr=0x%lx, block_number=%lu, count=%d, id=%d\n", + LOG_DRIVER("Received command: code=%d, paddr=0x%lx, block_number=%lu, " + "count=%d, id=%d\n", driver_state.blk_req.code, driver_state.blk_req.paddr, driver_state.blk_req.blk_number, driver_state.blk_req.blk_count, driver_state.blk_req.id); } diff --git a/drivers/timer/apb_timer/timer.c b/drivers/timer/apb_timer/timer.c index bd4c48b1f..87ca8d12c 100644 --- a/drivers/timer/apb_timer/timer.c +++ b/drivers/timer/apb_timer/timer.c @@ -22,7 +22,7 @@ #define LOG_APBTIMER_ERR(...) do{ sddf_dprintf("APBTIMER|ERROR: "); sddf_dprintf(__VA_ARGS__); }while(0) /* - * Adjust NUM_TIMERS if synthesised with more timers. + * Adjust NUM_TIMERS if synthesised with more timers. * Minimum = 2 due to a bug in the HDL, assumed for rest * of this driver. */ diff --git a/tools/make/board/common.mk b/tools/make/board/common.mk index 9d6629803..4531cc786 100644 --- a/tools/make/board/common.mk +++ b/tools/make/board/common.mk @@ -72,7 +72,7 @@ COMMON_CONFIG += ${TOOLCHAIN} \ ${MICROKIT_BOARD} \ ${MICROKIT_CONFIG} \ ${SMP_CONFIG} \ - ${BENCH_PMU_EVENTS} + ${BENCH_PMU_EVENTS} CHECK_FLAGS_BOARD_HASH := .board_cflags-$(shell echo -- ${COMMON_CONFIG} | \ shasum | sed 's/ *-//g') From 385953ff3f8d18c30003294374a2c10e99cc77c9 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Mon, 25 May 2026 12:52:48 +1000 Subject: [PATCH 10/10] Remove CLANG default toolchain This is now set in common.mk. Signed-off-by: Peter Chubb --- examples/blk/blk.mk | 4 ---- examples/echo_server/echo.mk | 1 - examples/gpu/gpu.mk | 3 --- examples/i2c/i2c.mk | 4 ---- examples/i2c_bus_scan/i2cscan.mk | 4 ---- examples/ina219/ina219.mk | 4 ---- examples/serial/serial.mk | 1 - examples/timer/timer.mk | 4 ---- 8 files changed, 25 deletions(-) diff --git a/examples/blk/blk.mk b/examples/blk/blk.mk index a5752f309..05cc0f7ae 100644 --- a/examples/blk/blk.mk +++ b/examples/blk/blk.mk @@ -15,10 +15,6 @@ ifeq ($(strip $(SDDF)),) $(error SDDF must be specified) endif -ifeq ($(strip $(TOOLCHAIN)),) - TOOLCHAIN := clang -endif - BUILD_DIR ?= build MICROKIT_CONFIG ?= debug diff --git a/examples/echo_server/echo.mk b/examples/echo_server/echo.mk index 26036e58b..69f4a4e81 100644 --- a/examples/echo_server/echo.mk +++ b/examples/echo_server/echo.mk @@ -26,7 +26,6 @@ SUPPORTED_BOARDS := \ x86_64_generic \ rpi4b_1gb -TOOLCHAIN ?= clang MICROKIT_CONFIG ?= debug SYSTEM_FILE := echo_server.system IMAGE_FILE := loader.img diff --git a/examples/gpu/gpu.mk b/examples/gpu/gpu.mk index 48ba1d875..8a08c2cb9 100644 --- a/examples/gpu/gpu.mk +++ b/examples/gpu/gpu.mk @@ -17,9 +17,6 @@ $(error "convert is not available. Please install imagemagick") endif SUPPORTED_BOARDS := qemu_virt_aarch64 -ifeq ($(strip ${TOOLCHAIN}),) - TOOLCHAIN := clang -endif include ${SDDF}/tools/make/board/common.mk TOP := ${SDDF}/examples/gpu diff --git a/examples/i2c/i2c.mk b/examples/i2c/i2c.mk index 693f2b037..ee8c55a9a 100644 --- a/examples/i2c/i2c.mk +++ b/examples/i2c/i2c.mk @@ -11,10 +11,6 @@ ifeq ($(strip $(MICROKIT_SDK)),) $(error MICROKIT_SDK must be specified) endif -ifeq ($(strip $(TOOLCHAIN)),) - TOOLCHAIN := clang -endif - PYTHONPATH := ${SDDF}/tools/meta:${PYTHONPATH} export PYTHONPATH diff --git a/examples/i2c_bus_scan/i2cscan.mk b/examples/i2c_bus_scan/i2cscan.mk index 4c5f44fa8..6ef44cd63 100644 --- a/examples/i2c_bus_scan/i2cscan.mk +++ b/examples/i2c_bus_scan/i2cscan.mk @@ -11,10 +11,6 @@ ifeq ($(strip $(MICROKIT_SDK)),) $(error MICROKIT_SDK must be specified) endif -ifeq ($(strip $(TOOLCHAIN)),) - TOOLCHAIN := clang -endif - PYTHONPATH := ${SDDF}/tools/meta:${PYTHONPATH} export PYTHONPATH diff --git a/examples/ina219/ina219.mk b/examples/ina219/ina219.mk index ce8deb4a0..dd7be0efc 100644 --- a/examples/ina219/ina219.mk +++ b/examples/ina219/ina219.mk @@ -11,10 +11,6 @@ ifeq ($(strip $(MICROKIT_SDK)),) $(error MICROKIT_SDK must be specified) endif -ifeq ($(strip $(TOOLCHAIN)),) - TOOLCHAIN := clang -endif - PYTHONPATH := ${SDDF}/tools/meta:${PYTHONPATH} export PYTHONPATH diff --git a/examples/serial/serial.mk b/examples/serial/serial.mk index bdf307155..fb7638805 100644 --- a/examples/serial/serial.mk +++ b/examples/serial/serial.mk @@ -19,7 +19,6 @@ IMAGE_FILE = loader.img REPORT_FILE = report.txt BUILD_DIR ?= build MICROKIT_CONFIG ?= debug -TOOLCHAIN ?= clang SUPPORTED_BOARDS:= cheshire \ hifive_p550 \ diff --git a/examples/timer/timer.mk b/examples/timer/timer.mk index 42a4c9523..d67c11365 100644 --- a/examples/timer/timer.mk +++ b/examples/timer/timer.mk @@ -37,10 +37,6 @@ SUPPORTED_BOARDS := \ x86_64_generic \ x86_64_generic_vtx -ifeq ($(strip $(TOOLCHAIN)),) - TOOLCHAIN := clang -endif - include ${SDDF}/tools/make/board/common.mk TOP := ${SDDF}/examples/timer