mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-02-21 17:45:30 -05:00
Add starting point for IGLOO2 RISV-V demo project.
This commit is contained in:
parent
483f4a8c4b
commit
9119e1e0e3
42 changed files with 13068 additions and 0 deletions
|
|
@ -0,0 +1,80 @@
|
|||
/*******************************************************************************
|
||||
* (c) Copyright 2016-2018 Microsemi SoC Products Group. All rights reserved.
|
||||
*
|
||||
* @file init.c
|
||||
* @author Microsemi SoC Products Group
|
||||
* @brief Mi-V soft processor memory section initializations and start-up code.
|
||||
*
|
||||
* SVN $Revision: 9661 $
|
||||
* SVN $Date: 2018-01-15 16:13:33 +0530 (Mon, 15 Jan 2018) $
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "encoding.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint32_t __sdata_load;
|
||||
extern uint32_t __sdata_start;
|
||||
extern uint32_t __sdata_end;
|
||||
|
||||
extern uint32_t __data_load;
|
||||
extern uint32_t __data_start;
|
||||
extern uint32_t __data_end;
|
||||
|
||||
extern uint32_t __sbss_start;
|
||||
extern uint32_t __sbss_end;
|
||||
extern uint32_t __bss_start;
|
||||
extern uint32_t __bss_end;
|
||||
|
||||
|
||||
static void copy_section(uint32_t * p_load, uint32_t * p_vma, uint32_t * p_vma_end)
|
||||
{
|
||||
while(p_vma <= p_vma_end)
|
||||
{
|
||||
*p_vma = *p_load;
|
||||
++p_load;
|
||||
++p_vma;
|
||||
}
|
||||
}
|
||||
|
||||
static void zero_section(uint32_t * start, uint32_t * end)
|
||||
{
|
||||
uint32_t * p_zero = start;
|
||||
|
||||
while(p_zero <= end)
|
||||
{
|
||||
*p_zero = 0;
|
||||
++p_zero;
|
||||
}
|
||||
}
|
||||
|
||||
void _init(void)
|
||||
{
|
||||
extern int main(int, char**);
|
||||
const char *argv0 = "hello";
|
||||
char *argv[] = {(char *)argv0, NULL, NULL};
|
||||
|
||||
copy_section(&__sdata_load, &__sdata_start, &__sdata_end);
|
||||
copy_section(&__data_load, &__data_start, &__data_end);
|
||||
zero_section(&__sbss_start, &__sbss_end);
|
||||
zero_section(&__bss_start, &__bss_end);
|
||||
|
||||
main(1, argv);
|
||||
}
|
||||
|
||||
/* Function called after main() finishes */
|
||||
void
|
||||
_fini()
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue