Skip to content

Commit 386a172

Browse files
committed
Fix regressions detected by github workflows
1 parent 50725b3 commit 386a172

File tree

10 files changed

+22
-16
lines changed

10 files changed

+22
-16
lines changed

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ project(wolfBoot)
4545
include(cmake/utils.cmake)
4646
include(cmake/functions.cmake)
4747

48+
include_directories(include)
49+
include_directories(lib/wolfssl)
50+
4851
if(NOT DEFINED WOLFBOOT_TARGET)
4952
message(FATAL_ERROR "WOLFBOOT_TARGET must be defined")
5053
else()
@@ -620,6 +623,8 @@ if(NOT SPMATH AND NOT SPMATHALL)
620623
list(APPEND USER_SETTINGS USE_FAST_MATH)
621624
endif()
622625

626+
list(APPEND WOLFBOOT_DEFS WOLFSSL_USER_SETTINGS)
627+
623628
add_library(user_settings INTERFACE)
624629
target_compile_definitions(user_settings INTERFACE ${USER_SETTINGS} ${SIGN_OPTIONS})
625630

@@ -699,7 +704,7 @@ configure_file(include/target.h.in ${CMAKE_CURRENT_BINARY_DIR}/target.h @ONLY)
699704

700705
add_library(target INTERFACE)
701706
target_compile_definitions(target INTERFACE ${WOLFBOOT_DEFS})
702-
target_include_directories(target BEFORE INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
707+
target_include_directories(target BEFORE INTERFACE ${CMAKE_CURRENT_BINARY_DIR} lib/wolfssl)
703708

704709
set(KEYSTORE ${CMAKE_CURRENT_BINARY_DIR}/keystore.c)
705710

arch.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ ifeq ($(ARCH),ARM)
253253
CORTEX_A5=1
254254
UPDATE_OBJS:=src/update_ram.o
255255
CFLAGS+=-DWOLFBOOT_DUALBOOT -DEXT_FLASH -DNAND_FLASH -fno-builtin -ffreestanding
256-
#CFLAGS+=-DWOLFBOOT_USE_STDLIBC
256+
CFLAGS+=-DWOLFBOOT_USE_STDLIBC
257257
endif
258258

259259
## Cortex CPU

hal/sama5d3.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static int division(uint32_t dividend,
7878
return 0;
7979
}
8080

81-
static uint32_t div(uint32_t dividend, uint32_t divisor)
81+
static uint32_t div_u(uint32_t dividend, uint32_t divisor)
8282
{
8383
uint32_t quotient = 0;
8484
uint32_t remainder = 0;
@@ -504,7 +504,7 @@ static void nand_read_info(void)
504504
nand_flash.bad_block_pos = (*(uint16_t *)(onfi_data + PARAMS_POS_FEATURES)) & 1;
505505
nand_flash.ext_page_len = *(uint16_t *)(onfi_data + PARAMS_POS_EXT_PARAM_PAGE_LEN);
506506
nand_flash.parameter_page = *(uint16_t *)(onfi_data + PARAMS_POS_PARAMETER_PAGE);
507-
nand_flash.pages_per_block = div(nand_flash.block_size, nand_flash.page_size);
507+
nand_flash.pages_per_block = div_u(nand_flash.block_size, nand_flash.page_size);
508508
nand_flash.pages_per_device = nand_flash.pages_per_block * nand_flash.block_count;
509509
nand_flash.oob_size = *(uint16_t *)(onfi_data + PARAMS_POS_OOBSIZE);
510510
nand_flash.revision = *(uint16_t *)(onfi_data + PARAMS_POS_REVISION);
@@ -605,8 +605,8 @@ static int nand_check_bad_block(uint32_t block)
605605
int ext_flash_read(uintptr_t address, uint8_t *data, int len)
606606
{
607607
uint8_t buffer_page[NAND_FLASH_PAGE_SIZE];
608-
uint32_t block = div(address, nand_flash.block_size); /* The block where the address falls in */
609-
uint32_t page = div(address, nand_flash.page_size); /* The page where the address falls in */
608+
uint32_t block = div_u(address, nand_flash.block_size); /* The block where the address falls in */
609+
uint32_t page = div_u(address, nand_flash.page_size); /* The page where the address falls in */
610610
uint32_t start_page_in_block = mod(page, nand_flash.pages_per_block); /* The start page within this block */
611611
uint32_t in_block_offset = mod(address, nand_flash.block_size); /* The offset of the address within the block */
612612
uint32_t remaining = nand_flash.block_size - in_block_offset; /* How many bytes remaining to read in the first block */
@@ -637,7 +637,7 @@ int ext_flash_read(uintptr_t address, uint8_t *data, int len)
637637
} while (ret < 0);
638638

639639
/* Amount of pages to be read from this block */
640-
pages_to_read = div((sz + nand_flash.page_size - 1), nand_flash.page_size);
640+
pages_to_read = div_u((sz + nand_flash.page_size - 1), nand_flash.page_size);
641641

642642
if (pages_to_read * nand_flash.page_size > remaining)
643643
pages_to_read--;

hal/sim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ void do_boot(const uint32_t *app_offset)
378378

379379
wret = write(fd, app_offset, app_size);
380380
if (wret != app_size) {
381-
wolfBoot_printf( "can't write test-app to memfd, address %p: fd %d rval %d errno %d\n", app_offset, fd, wret, errno);
381+
wolfBoot_printf( "can't write test-app to memfd, address %p\n", app_offset);
382382
exit(-1);
383383
}
384384
wolfBoot_printf("Stored test-app to memfd, address %p (%zu bytes)\n", app_offset, wret);

include/wolfboot/wolfboot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ extern "C" {
205205
# define update_hash wc_Sha3Update
206206
# define final_hash wc_Sha3Final
207207
# define key_hash key_sha3_384
208-
typedef wc_sha3_384 wolfBoot_hash_t;
208+
typedef wc_Sha3 wolfBoot_hash_t;
209209
# define HDR_HASH HDR_SHA3_384
210210
#else
211211
# error "No valid hash algorithm defined!"

src/elf.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#endif
4949

5050

51-
#ifdef MMU
51+
#if defined(MMU) || defined (WOLFBOOT_FSP) || defined (ARCH_PPC)
5252
/* Loader for elf32 or elf64 format program headers
5353
* Returns the entry point function
5454
*/
@@ -181,7 +181,7 @@ int elf_hdr_size(const unsigned char *ehdr)
181181
}
182182
return sz;
183183
}
184-
184+
#if !defined(MMU) && !defined(WOLFBOOT_FSP) && !defined(ARCH_PPC)
185185
int elf_store_image_scattered(const unsigned char *hdr, unsigned long *entry_out, int ext_flash) {
186186
const unsigned char *image;
187187
int is_elf32;
@@ -274,6 +274,7 @@ int elf_store_image_scattered(const unsigned char *hdr, unsigned long *entry_out
274274
}
275275
return 0;
276276
}
277+
#endif
277278

278279

279280
int elf_load_image(uint8_t *image, uintptr_t *entry, int ext_flash)

src/image.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ static int header_sha256(wc_Sha256 *sha256_ctx, struct wolfBoot_image *img)
833833
if (stored_sha_len != WOLFBOOT_SHA_DIGEST_SIZE)
834834
return -1;
835835
#ifdef WOLFBOOT_ENABLE_WOLFHSM_CLIENT
836-
(void)wc_InitSha256_ex(&sha256_ctx, NULL, hsmClientDevIdHash);
836+
(void)wc_InitSha256_ex(sha256_ctx, NULL, hsmClientDevIdHash);
837837
#else
838838
wc_InitSha256(sha256_ctx);
839839
#endif
@@ -924,7 +924,7 @@ static int header_sha384(wc_Sha384 *sha384_ctx, struct wolfBoot_image *img)
924924
if (stored_sha_len != WOLFBOOT_SHA_DIGEST_SIZE)
925925
return -1;
926926
#ifdef WOLFBOOT_ENABLE_WOLFHSM_CLIENT
927-
(void)wc_InitSha384_ex(&sha384_ctx, NULL, hsmClientDevIdHash);
927+
(void)wc_InitSha384_ex(sha384_ctx, NULL, hsmClientDevIdHash);
928928
#else
929929
wc_InitSha384(sha384_ctx);
930930
#endif

src/update_ram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ void RAMFUNCTION wolfBoot_start(void)
271271

272272
#ifdef WOLFBOOT_ELF
273273
/* Load elf */
274-
if (elf_load_image((uint8_t*)load_address, (uintptr_t*)&load_address) != 0){
274+
if (elf_load_image_mmu((uint8_t*)load_address, (uintptr_t*)&load_address, NULL) != 0){
275275
wolfBoot_printf("Invalid elf, falling back to raw binary\n");
276276
}
277277
#endif

tools/elf-parser/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
CC=gcc
66
CFLAGS=-Wall -g -ggdb
7-
CFLAGS+=-I../../include -DWOLFBOOT_ELF -DELF_PARSER -DPRINTF_ENABLED
7+
CFLAGS+=-I../../include -DWOLFBOOT_ELF -DELF_PARSER -DPRINTF_ENABLED -DMMU -DARCH_FLASH_OFFSET=0
88
EXE=elf-parser
99

1010
LIBS=

tools/elf-parser/elf-parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
7070
fclose(f);
7171

7272
if (ret == 0) {
73-
ret = elf_load_image(image, &entry);
73+
ret = elf_load_image_mmu(image, &entry, NULL);
7474
}
7575

7676
printf("Return %d, Load %p\n", ret, (void*)entry);

0 commit comments

Comments
 (0)