Skip to content

Commit

Permalink
Fix stack issue and implement RX GCC do_boot. Increased user stack …
Browse files Browse the repository at this point in the history
…to 16KB and interrupt stack to 4KB.
  • Loading branch information
dgarske committed Mar 8, 2024
1 parent eae8623 commit 3c74a4a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
20 changes: 8 additions & 12 deletions hal/rx65n.ld
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,7 @@ SECTIONS
_mdata = .;
} > ROM

.ustack 0x200: AT(0x200)
{
_ustack = .;
} > RAM

.istack 0x100: AT(0x100)
{
_istack = .;
} > RAM

.data 0x204: AT(_mdata)
.data : AT(_mdata)
{
_data = .;
*(.data)
Expand All @@ -142,7 +132,7 @@ SECTIONS
_ebss = .;
. = ALIGN(128);
_end = .;
} > RAM AT>RAM
} > RAM

.ofs1 0xFE7F5D00: AT(0xFE7F5D00)
{
Expand Down Expand Up @@ -178,6 +168,12 @@ SECTIONS
} > OFS
}


/* reserve 16KB user stack */
PROVIDE(_ustack = ORIGIN(RAM) + LENGTH(RAM) - 0x4000 );
/* reserve 4KB interrupt stack */
PROVIDE(_istack = ORIGIN(RAM) + LENGTH(RAM) - 0x4000 - 0x1000 );

_wolfboot_partition_boot_address = @WOLFBOOT_PARTITION_BOOT_ADDRESS@;
_wolfboot_partition_size = @WOLFBOOT_PARTITION_SIZE@;
_wolfboot_partition_update_address = @WOLFBOOT_PARTITION_UPDATE_ADDRESS@;
Expand Down
20 changes: 8 additions & 12 deletions hal/rx72n.ld
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,7 @@ SECTIONS
_mdata = .;
} > ROM

.ustack 0x200: AT(0x200)
{
_ustack = .;
} > RAM

.istack 0x100: AT(0x100)
{
_istack = .;
} > RAM

.data 0x204: AT(_mdata)
.data : AT(_mdata)
{
_data = .;
*(.data)
Expand All @@ -142,7 +132,7 @@ SECTIONS
_ebss = .;
. = ALIGN(128);
_end = .;
} > RAM AT>RAM
} > RAM

.ofs1 0xFE7F5D00: AT(0xFE7F5D00)
{
Expand Down Expand Up @@ -178,6 +168,12 @@ SECTIONS
} > OFS
}


/* reserve 16KB user stack */
PROVIDE(_ustack = ORIGIN(RAM) + LENGTH(RAM) - 0x4000 );
/* reserve 4KB interrupt stack */
PROVIDE(_istack = ORIGIN(RAM) + LENGTH(RAM) - 0x4000 - 0x1000 );

_wolfboot_partition_boot_address = @WOLFBOOT_PARTITION_BOOT_ADDRESS@;
_wolfboot_partition_size = @WOLFBOOT_PARTITION_SIZE@;
_wolfboot_partition_update_address = @WOLFBOOT_PARTITION_UPDATE_ADDRESS@;
Expand Down
11 changes: 7 additions & 4 deletions src/boot_renesas.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern uint32_t IMAGE_APP_RAM_start;
*
*/

#if defined(__CCRX__)
#if defined(__RX__) && defined(__CCRX__)
#pragma inline_asm longJump
static void longJump(const uint32_t *app_offset)
{
Expand All @@ -54,9 +54,12 @@ void do_boot(const uint32_t *app_offset)
(void) app_sp;
(void) app_entry;
#if defined(__RX__)
/* TOOD: Add jump */
#elif defined(__CCRX__)
longJump(app_offset);
/* Do unconditional jump (r1 = app_offset) */
#if defined(__CCRX__)
longJump(app_offset);
#else
__asm("jmp r1");
#endif
#elif defined(_RENESAS_RA_)
app_sp = VECTOR_SP;

Expand Down

0 comments on commit 3c74a4a

Please sign in to comment.