Skip to content

Commit 5e203e6

Browse files
committed
Addressed review comments
1 parent 43c2cce commit 5e203e6

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

hal/renesas-rx.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -500,22 +500,21 @@ void hal_prepare_boot(void)
500500

501501
}
502502

503-
#ifdef __CCRX__
504-
/* copy RAM functions from ROM to RAM */
505-
static void copyfuncs(void)
506-
{
507-
unsigned char *dst, *src;
508-
src = __sectop("PFRAM");
509-
dst = __sectop("RPFRAM");
510-
while(src < __secend("PFRAM")) {
511-
*dst++ = *src++;
512-
}
513-
}
514-
#endif
515503
int hal_flash_init(void)
516504
{
517505
#ifdef __CCRX__
518-
copyfuncs();
506+
unsigned char *src, *dst;
507+
size_t n;
508+
509+
src = (unsigned char*)__sectop("PFRAM");
510+
dst = (unsigned char*)__sectop("RPFRAM");
511+
512+
n = (size_t)((unsigned char*)__secend("PFRAM") -
513+
(unsigned char*)__sectop("PFRAM"));
514+
wolfBoot_printf("RAM Function start = 0x%p\n", __sectop("RPFRAM"));
515+
wolfBoot_printf("RAM Function end = 0x%p\n", __secend("RPFRAM"));
516+
wolfBoot_printf("RAM Function size = %d\n", n);
517+
memcpy(dst, src, n);
519518
#endif
520519
/* Flash Write Enable */
521520
FLASH_FWEPROR = FLASH_FWEPROR_FLWE;
@@ -542,7 +541,7 @@ int hal_flash_init(void)
542541
int RAMFUNCTION hal_flash_write(uint32_t addr, const uint8_t *data, int len)
543542
{
544543
int i;
545-
uint8_t codeblock[FLASH_FACI_CODE_BLOCK_SZ] = {0};
544+
uint8_t codeblock[FLASH_FACI_CODE_BLOCK_SZ];
546545
uint16_t* data16 = (uint16_t*)data;
547546
uint32_t block_base;
548547
uint32_t offset;
@@ -554,15 +553,14 @@ int RAMFUNCTION hal_flash_write(uint32_t addr, const uint8_t *data, int len)
554553
block_base = addr & ~(FLASH_FACI_CODE_BLOCK_SZ - 1);
555554
offset = addr - block_base;
556555

557-
XMEMCPY(codeblock, (uint8_t*)block_base, FLASH_FACI_CODE_BLOCK_SZ);
556+
memcpy(codeblock, (uint8_t*)block_base, FLASH_FACI_CODE_BLOCK_SZ);
558557
write_size = FLASH_FACI_CODE_BLOCK_SZ - offset;
559558
if (write_size > len)
560559
write_size = len;
561560

562-
XMEMCPY(&codeblock[offset], data, write_size);
561+
memcpy(&codeblock[offset], data, write_size);
563562
data16 = (uint16_t*)codeblock;
564563

565-
566564
FLASH_FSADDR = block_base;
567565
/* flash program command */
568566
FLASH_FACI_CMD8 = FLASH_FACI_CMD_PROGRAM;

src/boot_renesas.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,6 @@ static void longJump(const uint32_t *app_offset)
5555
jmp r1;
5656
}
5757
#endif
58-
static void verify_flash_write(uint32_t addr, int len)
59-
{
60-
uint8_t *p = (uint8_t *)addr;
61-
int i;
62-
printf("verify addr=0x%08x: ", addr);
63-
for (i = 0; i < len && i < 8; i++) {
64-
printf("%02x ", p[i]);
65-
}
66-
printf("\n");
67-
}
6858

6959
/* Calls the application entry point */
7060
void do_boot(const uint32_t *app_offset)

src/string.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ void RAMFUNCTION *memcpy(void *dst, const void *src, size_t n)
282282

283283
return dst;
284284
}
285+
#ifdef __CCRX__
286+
#pragma section
287+
#endif
285288
#endif /* IAR */
286289

287290
#if !defined(__IAR_SYSTEMS_ICC__) && !defined(__CCRX__)

0 commit comments

Comments
 (0)