[PATCH v3 1/2] bsp/riscv: Work area size based on stack pointer
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jul 15 13:00:02 UTC 2022
On 14.07.22 16:03, Daniel Cederman wrote:
> diff --git a/bsps/riscv/shared/start/start.S b/bsps/riscv/shared/start/start.S
> index 3702f8ac2f..21945a99f5 100644
> --- a/bsps/riscv/shared/start/start.S
> +++ b/bsps/riscv/shared/start/start.S
> @@ -35,6 +35,16 @@
> #include <bsp/linker-symbols.h>
> #include <bspopts.h>
>
> +#if __riscv_xlen == 32
> +#define PTR_ALIGN 2
> +#define PTR_SIZE 4
> +#define PTR_VALUE .word
> +#elif __riscv_xlen == 64
> +#define PTR_ALIGN 3
> +#define PTR_SIZE 8
> +#define PTR_VALUE .dword
> +#endif
Maybe this should move to asm.h.
> +
> PUBLIC(_start)
>
> .section .bsp_start_text, "wax", @progbits
> @@ -60,6 +70,9 @@ SYM(_start):
> LADDR t0, _RISCV_Exception_handler
> csrw mtvec, t0
>
> + /* Save stack pointer so it can mark end of work area later on */
> + mv t3, sp
> +
> /* Load stack pointer and branch to secondary processor start if necessary */
> #ifdef RTEMS_SMP
> LADDR sp, _ISR_Stack_area_begin
> @@ -75,6 +88,9 @@ SYM(_start):
> LADDR sp, _ISR_Stack_area_end
> #endif
>
> + LADDR t0, riscv_start_stack_pointer
> + SREG t3, 0(t0)
> +
> #ifdef BSP_START_COPY_FDT_FROM_U_BOOT
> mv a0, a1
> call bsp_fdt_copy
> @@ -146,3 +162,12 @@ SYM(_start):
> #endif
>
> #endif /* RTEMS_SMP */
> +
> + .section .data, "aw"
This should be .bsp_start_data
> + .align PTR_ALIGN
> +
> + .globl riscv_start_stack_pointer
> + .type riscv_start_stack_pointer, @object
> + .size riscv_start_stack_pointer, PTR_SIZE
> +riscv_start_stack_pointer:
> + PTR_VALUE 0
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
More information about the devel
mailing list