Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/casting conversion warnings #2026

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
3 changes: 1 addition & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ project(
'c_std=c11',
'optimization=s',
'debug=true',
# 'warning_level=3', # TODO: Enable by default when all warnings are fixed
'warning_level=2',
'warning_level=3',
'werror=false',
'b_ndebug=if-release',
],
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/ctxlink/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bool platform_configure_uart(char *configuration_string)
uint32_t stopBits;
char parity;
int count = sscanf(
configuration_string, "%" SCNd32 ",%" SCNd32 ",%c,%" SCNd32 "", &baudRate, &bits, &parity, &stopBits);
configuration_string, "%" SCNu32 ",%" SCNu32 ",%c,%" SCNu32 "", &baudRate, &bits, &parity, &stopBits);
if (count == 4) {
uint32_t parityValue;
usart_set_baudrate(USBUSART, baudRate);
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/hosted/gdb_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static sockaddr_storage_s sockaddr_prepare(const uint16_t port)
addrinfo_s *results = NULL;
int res = getaddrinfo(NULL, "0", &hints, &results);
if (res || !results) {
DEBUG_WARN("getaddrinfo returned %d (errno = %d), results is %p\n", res, errno, results);
DEBUG_WARN("getaddrinfo returned %d (errno = %d), results is %p\n", res, errno, (void *)results);
return (sockaddr_storage_s){AF_UNSPEC};
}

Expand Down
4 changes: 2 additions & 2 deletions src/platforms/stlinkv3/usb_f723.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ static void stm32f723_ep_setup(usbd_device *usbd_dev, uint8_t addr, uint8_t type
OTG_DIEPCTL0_SNAK | (type << 18) | OTG_DIEPCTL0_USBAEP | OTG_DIEPCTLX_SD0PID | (addr << 22) | max_size;

if (callback)
usbd_dev->user_callback_ctr[addr][USB_TRANSACTION_IN] = (void *)callback;
usbd_dev->user_callback_ctr[addr][USB_TRANSACTION_IN] = callback;
}

if (!dir) {
Expand All @@ -218,7 +218,7 @@ static void stm32f723_ep_setup(usbd_device *usbd_dev, uint8_t addr, uint8_t type
(type << 18) | max_size;

if (callback)
usbd_dev->user_callback_ctr[addr][USB_TRANSACTION_OUT] = (void *)callback;
usbd_dev->user_callback_ctr[addr][USB_TRANSACTION_OUT] = callback;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/target/adi.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static const char *adi_cid_class_string(const cid_class_e cid_class)
default:
return "Unknown component"; /* Noted as reserved in the spec */
}
};
}
#endif

uint16_t adi_designer_from_pidr(const uint64_t pidr)
Expand Down
6 changes: 3 additions & 3 deletions src/target/ch579.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@
#define CH579_CONST_ROM_CMD_PROGRAM_INFO 0x99U

/* Flash Protect base value; upper bits must be set*/
#define CH579_RB_ROM_WE_MUST_10 0b10000000U
#define CH579_RB_ROM_WE_MUST_10 (1U << 7U)
/* Flash Protect Bitmasks */
#define CH579_RB_ROM_CODE_WE 1U << 3U
#define CH579_RB_ROM_DATA_WE 1U << 2U
#define CH579_RB_ROM_CODE_WE (1U << 3U)
#define CH579_RB_ROM_DATA_WE (1U << 2U)
/* Flash Protect Standard value */
#define CH579_RB_ROM_WRITE_ENABLE CH579_RB_ROM_WE_MUST_10 | CH579_RB_ROM_CODE_WE | CH579_RB_ROM_DATA_WE
#define CH579_RB_ROM_WRITE_DISABLE CH579_RB_ROM_WE_MUST_10
Expand Down
2 changes: 1 addition & 1 deletion src/target/efm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ bool efm32_aap_probe(adiv5_access_port_s *ap)

adiv5_ap_ref(ap);
t->priv = ap;
t->priv_free = (void *)adiv5_ap_unref;
t->priv_free = (priv_free_func)adiv5_ap_unref;

/* Read status */
DEBUG_INFO("EFM32: AAP STATUS=%08" PRIx32 "\n", adiv5_ap_read(ap, AAP_STATUS));
Expand Down
2 changes: 1 addition & 1 deletion src/target/kinetis.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ bool kinetis_mdm_probe(adiv5_access_port_s *ap)
t->mass_erase = kinetis_mdm_mass_erase;
adiv5_ap_ref(ap);
t->priv = ap;
t->priv_free = (void *)adiv5_ap_unref;
t->priv_free = (priv_free_func)adiv5_ap_unref;

t->driver = "Kinetis Recovery (MDM-AP)";
t->regs_size = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/target/nrf51.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ bool nrf51_ctrl_ap_probe(adiv5_access_port_s *ap)
t->mass_erase = nrf51_ctrl_ap_mass_erase;
adiv5_ap_ref(ap);
t->priv = ap;
t->priv_free = (void *)adiv5_ap_unref;
t->priv_free = (priv_free_func)adiv5_ap_unref;

adiv5_ap_read(ap, CTRL_AP_PROT_EN);
const uint32_t status = adiv5_ap_read(ap, CTRL_AP_PROT_EN);
Expand Down
2 changes: 1 addition & 1 deletion src/target/nrf54l.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ bool nrf54l_ctrl_ap_probe(adiv5_access_port_s *ap)
target->mass_erase = nrf54l_ctrl_ap_mass_erase;
adiv5_ap_ref(ap);
target->priv = ap;
target->priv_free = (void *)adiv5_ap_unref;
target->priv_free = (priv_free_func)adiv5_ap_unref;

const uint32_t status = adiv5_ap_read(ap, NRF54L_CTRL_AP_APPROTECT_STATUS);

Expand Down
6 changes: 4 additions & 2 deletions src/target/target_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct target_flash {
};

/*
* ¹the mass_erase method must not cause any side effects outside the scope/address space of the flash
* ¹the mass_erase method must not cause any side effects outside the scope/address space of the flash
* consider using the target mass_erase method instead for such cases
*/

Expand Down Expand Up @@ -113,6 +113,8 @@ struct breakwatch {

#define MAX_CMDLINE 81

typedef void (*priv_free_func)(void *flash);

struct target {
target_controller_s *tc;

Expand Down Expand Up @@ -180,7 +182,7 @@ struct target {
target_s *next;

void *priv;
void (*priv_free)(void *);
priv_free_func priv_free;

/* Target designer and ID / partno */
uint16_t designer_code;
Expand Down
Loading