blisp/lib/chip/blisp_chip_bl70x.c
Berk D. Demir e959756f5a Refactor to address compiler warnings
- Unused function warnings
Move function definitions in include/blisp_util.h to lib/blisp_util.c.
Defining them as static leads to internal linkage, accessible in that
translation unit, hence the warning. Their references are to be handled
in other translation units, so they shouldn't be static.

- Unused function parameters
Use C attribute `[[maybe_unused]]` (introduced in C23) to suppress
unused parameter warnings.

  - `blisp_chip_xxxxx_get_eflash_loader` implementations accept clock type
    but don't use it.

  - `drain` function only has a body under macOS and FreeBSD with
    preprocessor predicates.

- Enable compiler warnings
Now that warnings are address enable them `-Wall -Wextra -Wpedantic` for
the library and the tool targets.

N.B. An equivalent of MSVC should be added to CMakeLists.txt, as these
would only work when using GCC or Clang.
2023-04-30 10:21:34 -07:00

26 lines
815 B
C

// SPDX-License-Identifier: MIT
#include <stdlib.h>
#include <string.h>
#include "../../data/bl70x_eflash_loader.h"
#include "blisp.h"
int64_t blisp_chip_bl70x_get_eflash_loader([[maybe_unused]] uint8_t clk_type, uint8_t** firmware_buf_ptr)
{
uint8_t* firmware_buf = malloc(sizeof(bl70x_eflash_loader_bin));
memcpy(firmware_buf, bl70x_eflash_loader_bin, sizeof(bl70x_eflash_loader_bin));
*(firmware_buf + 0xE0) = 1; // TODO: 32 MHz clock
*firmware_buf_ptr = firmware_buf;
return sizeof(bl70x_eflash_loader_bin);
}
struct blisp_chip blisp_chip_bl70x = {
.type = BLISP_CHIP_BL70X,
.type_str = "bl70x",
.usb_isp_available = true,
.default_xtal = "32m",
.handshake_byte_multiplier = 0.003f,
.load_eflash_loader = blisp_chip_bl70x_get_eflash_loader,
.tcm_address = 0x22010000
};