Skip to content

Commit ea0b4fb

Browse files
committed
Added missing files + cosmetics as per review
- Added missing `test-app/app_sim_scattered.c` - Added missing `test-app/sim_scattered.ld` - Fixed comments at the end of define blocks for consistency - Removed unused constants as indicated
1 parent 9c3e862 commit ea0b4fb

File tree

4 files changed

+79
-4
lines changed

4 files changed

+79
-4
lines changed

include/wolfboot/wolfboot.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ extern "C" {
312312
#define IMG_STATE_FINAL_FLAGS 0x30
313313
/* ELF loading state - only valid on boot partition so doesn't conflict with
314314
* IMAGE_STATE_UPDATING */
315-
#define IMG_STATE_ELF_LOADING 0x70
316315
#define IMG_STATE_TESTING 0x10
317316
#define IMG_STATE_SUCCESS 0x00
318317
#define FLASH_BYTE_ERASED 0xFF
@@ -322,7 +321,6 @@ extern "C" {
322321
#define IMG_STATE_UPDATING 0x8F
323322
#define IMG_STATE_TESTING 0xEF
324323
#define IMG_STATE_FINAL_FLAGS 0xBF
325-
#define IMG_STATE_ELF_LOADING 0x70
326324
#define IMG_STATE_SUCCESS 0xFF
327325
#define FLASH_BYTE_ERASED 0x00
328326
#define FLASH_WORD_ERASED 0x00000000UL

src/elf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ int elf_load_image_mmu(uint8_t *image, uintptr_t *entry, elf_mmu_map_cb mmu_cb)
149149

150150
return 0;
151151
}
152-
#endif /* MMU */
152+
#endif /* MMU || WOLFBOOT_FSP || ARCH_PPC */
153153

154154
int elf_open(const unsigned char *ehdr, int *is_elf32)
155155
{
@@ -281,7 +281,7 @@ int elf_store_image_scattered(const unsigned char *hdr, unsigned long *entry_out
281281
}
282282
return 0;
283283
}
284-
#endif
284+
#endif /* !defined(MMU) && !defined(WOLFBOOT_FSP) && !defined(ARCH_PPC) && defined (WOLFBOOT_ELF_SCATTERED) */
285285

286286

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

test-app/app_sim_scattered.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* app_sim_scattered.c
2+
*
3+
* Test bare-metal boot-led-on application
4+
*
5+
* Copyright (C) 2025 wolfSSL Inc.
6+
*
7+
* This file is part of wolfBoot.
8+
*
9+
* wolfBoot is free software; you can redistribute it and/or modify
10+
* it under the terms of the GNU General Public License as published by
11+
* the Free Software Foundation; either version 3 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* wolfBoot is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU General Public License
20+
* along with this program; if not, write to the Free Software
21+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
22+
*/
23+
24+
#include "target.h"
25+
26+
#include "wolfboot/wolfboot.h"
27+
28+
#ifdef TARGET_sim
29+
30+
31+
__attribute__((section(".r3text")))
32+
int do_cmd(const char *cmd)
33+
{
34+
/* Do nothing */
35+
return 0;
36+
}
37+
38+
__attribute__((section(".r2text")))
39+
int do_exec_cmd(char *name)
40+
{
41+
return do_cmd(name);
42+
}
43+
44+
__attribute__((section(".r1text")))
45+
int main(int argc, char *argv[]) {
46+
do_exec_cmd((void *)0);
47+
return 0;
48+
}
49+
#endif /** TARGET_sim **/

test-app/sim_scattered.ld

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
ENTRY(main)
2+
3+
SECTIONS
4+
{
5+
. = 0x100000;
6+
__r1_start = .;
7+
.r1text : { *(.r1text) }
8+
.r1data : { *(.r1data) }
9+
__r1_end = .;
10+
11+
. = 0x140000;
12+
__r2_start = .;
13+
.r2text : { *(.r2text) }
14+
.r2data : { *(.r2data) }
15+
__r2_end = .;
16+
17+
. = 0x180000;
18+
__r3_start = .;
19+
.r3text : { *(.r3text) }
20+
.r3data : { *(.r3data) }
21+
22+
.text : { *(.text*) }
23+
.rodata : { *(.rodata*) }
24+
__r3_end = .;
25+
26+
PROVIDE(__image_start = 0x100000);
27+
PROVIDE(__image_end = .);
28+
}

0 commit comments

Comments
 (0)