changed to compile libxil as part of application, to be moved into lib

This commit is contained in:
2023-09-11 17:26:42 +02:00
parent 08302ed7d4
commit dcce9574c8
15 changed files with 121 additions and 70 deletions

View File

@ -46,6 +46,8 @@ target_include_directories(
freertos_config INTERFACE ${BSP_PATH}/include) freertos_config INTERFACE ${BSP_PATH}/include)
# our compiler options, will trickle down through the project # our compiler options, will trickle down through the project
target_compile_options(freertos_config INTERFACE -c -fmessage-length=0 -g -O0 -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -ffunction-sections -fdata-sections) target_compile_options(freertos_config INTERFACE -c -fmessage-length=0 -g -O0 -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -ffunction-sections -fdata-sections)
add_subdirectory(${FreeRTOS_PATH}) add_subdirectory(${FreeRTOS_PATH})
add_subdirectory(bsp_z7) add_subdirectory(bsp_z7)
@ -57,7 +59,7 @@ add_subdirectory(${MISSION_PATH})
# ############################################################################## # ##############################################################################
# Add libraries for all sources. # Add libraries for all sources.
target_link_libraries(${TARGET_NAME} PRIVATE freertos_kernel ${CMAKE_SOURCE_DIR}/${BSP_PATH}/lib/libxil.a) target_link_libraries(${TARGET_NAME} PUBLIC freertos_kernel)
# Add include paths for all sources. # Add include paths for all sources.
target_include_directories( target_include_directories(

View File

@ -1 +1,2 @@
add_subdirectory(freeRTOS) add_subdirectory(freeRTOS)
add_subdirectory(ps7_cortexa9_0)

View File

@ -1 +0,0 @@
../ps7_cortexa9_0/lib/libxil.a

View File

@ -0,0 +1,5 @@
add_subdirectory(libsrc/scugic)
add_subdirectory(libsrc/scutimer)
add_subdirectory(libsrc/scuwdt)
add_subdirectory(libsrc/standalone)
add_subdirectory(libsrc/uartps)

View File

@ -7,6 +7,7 @@
/* Definition for CPU ID */ /* Definition for CPU ID */
#define XPAR_CPU_ID 0U #define XPAR_CPU_ID 0U
#define USE_AMP 0U
/* Definitions for peripheral PS7_CORTEXA9_0 */ /* Definitions for peripheral PS7_CORTEXA9_0 */
#define XPAR_PS7_CORTEXA9_0_CPU_CLK_FREQ_HZ 666666687 #define XPAR_PS7_CORTEXA9_0_CPU_CLK_FREQ_HZ 666666687

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
target_sources(${TARGET_NAME} PUBLIC
src/xscugic_g.c
src/xscugic.c
src/xscugic_intr.c
src/xscugic_selftest.c
src/xscugic_sinit.c
src/xscugic_hw.c
)

View File

@ -0,0 +1,6 @@
target_sources(${TARGET_NAME} PUBLIC
src/xscutimer.c
src/xscutimer_sinit.c
src/xscutimer_g.c
src/xscutimer_selftest.c
)

View File

@ -0,0 +1,6 @@
target_sources(${TARGET_NAME} PUBLIC
src/xscuwdt_sinit.c
src/xscuwdt_selftest.c
src/xscuwdt_g.c
src/xscuwdt.c
)

View File

@ -0,0 +1,52 @@
target_sources(${TARGET_NAME} PUBLIC
src/translation_table.S
src/cpu_init.S
src/boot.S
src/xil-crt0.S
src/asm_vectors.S
src/open.c
src/xil_exception.c
src/sbrk.c
src/xl2cc_counter.c
src/xil_cache.c
src/xil_spinlock.c
src/sleep.c
src/fstat.c
src/fcntl.c
src/putnum.c
src/_open.c
src/xil_testcache.c
src/xil_assert.c
src/_exit.c
src/time.c
src/xil_testio.c
src/xplatform_info.c
src/getpid.c
src/write.c
src/xil_mem.c
src/kill.c
src/xil_mmu.c
src/lseek.c
src/xil_util.c
src/getentropy.c
src/xil_testmem.c
src/isatty.c
src/read.c
src/inbyte.c
src/close.c
src/xil_sleeptimer.c
src/print.c
src/xil_printf.c
src/xil_misc_psreset_api.c
src/usleep.c
src/xil_sleepcommon.c
src/vectors.c
src/cpputest_time.c
src/errno.c
src/xpm_counter.c
src/xtime_l.c
src/outbyte.c
src/unlink.c
src/abort.c
src/_sbrk.c
)

View File

@ -0,0 +1,9 @@
target_sources(${TARGET_NAME} PUBLIC
src/xuartps.c
src/xuartps_hw.c
src/xuartps_intr.c
src/xuartps_selftest.c
src/xuartps_options.c
src/xuartps_sinit.c
src/xuartps_g.c
)

View File

@ -1 +1 @@
target_sources(${TARGET_NAME} PRIVATE main.c) target_sources(${TARGET_NAME} PRIVATE main.cpp)

View File

@ -62,7 +62,9 @@
/* Standard includes. */ /* Standard includes. */
#include <limits.h> #include <limits.h>
extern "C" {
#include <stdio.h> #include <stdio.h>
}
/* Scheduler include files. */ /* Scheduler include files. */
#include "FreeRTOS.h" #include "FreeRTOS.h"
@ -81,7 +83,8 @@
// #include "partest.h" // #include "partest.h"
/* Xilinx includes. */ /* Xilinx includes. */
//#include "platform.h" // #include "platform.h"
extern "C" {
#include "xil_exception.h" #include "xil_exception.h"
#include "xparameters.h" #include "xparameters.h"
#include "xscugic.h" #include "xscugic.h"
@ -89,11 +92,15 @@
#include "xuartps_hw.h" #include "xuartps_hw.h"
// TODO why? is in bsp // TODO why? is in bsp
void _exit(sint32 status) {
(void)status; void _exit(sint32 status);
while (1) {
; // (void)status;
} // while (1) {
// ;
// }
// }
sint32 _write(sint32 fd, char8 *buf, sint32 nbytes);
} }
/* /*
@ -189,7 +196,7 @@ static void prvQueueSendTask(void *pvParameters) {
/* Initialise xNextWakeTime - this only needs to be done once. */ /* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount(); xNextWakeTime = xTaskGetTickCount();
vTaskDelayUntil(&xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS / 2); // vTaskDelayUntil(&xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS / 2);
for (;;) { for (;;) {
/* Place this task in the blocked state until it is time to run again. */ /* Place this task in the blocked state until it is time to run again. */
@ -219,7 +226,7 @@ static void prvQueueReceiveTask(void *pvParameters) {
FreeRTOSConfig.h. */ FreeRTOSConfig.h. */
xQueueReceive(xQueue, &ulReceivedValue, portMAX_DELAY); xQueueReceive(xQueue, &ulReceivedValue, portMAX_DELAY);
uart_send('c'); uart_send('0');
/* To get here something must have been received from the queue, but /* To get here something must have been received from the queue, but
is it the expected value? If it is, toggle the LED. */ is it the expected value? If it is, toggle the LED. */
@ -233,13 +240,14 @@ static void prvQueueReceiveTask(void *pvParameters) {
int main(void) { int main(void) {
// *((uint32_t*)0xFFFFFFF0) = 0x030000A8;
// asm("SEV");
// //while(1);
/* Configure the hardware ready to run the demo. */ /* Configure the hardware ready to run the demo. */
prvSetupHardware(); prvSetupHardware();
printf("Booting Software\n");
/* Create the queue. */ /* Create the queue. */
xQueue = xQueueCreate(mainQUEUE_LENGTH, sizeof(uint32_t)); xQueue = xQueueCreate(mainQUEUE_LENGTH, sizeof(uint32_t));
@ -274,7 +282,6 @@ int main(void) {
a privileged mode (not user mode). */ a privileged mode (not user mode). */
for (;;) for (;;)
; ;
/* Don't expect to reach here. */ /* Don't expect to reach here. */
return 0; return 0;
} }
@ -308,7 +315,7 @@ static void prvSetupHardware(void) {
(void)xStatus; /* Remove compiler warning if configASSERT() is not defined. */ (void)xStatus; /* Remove compiler warning if configASSERT() is not defined. */
/* Initialise the LED port. */ /* Initialise the LED port. */
//vParTestInitialise(); // vParTestInitialise();
/* The Xilinx projects use a BSP that do not allow the start up code to be /* The Xilinx projects use a BSP that do not allow the start up code to be
altered easily. Therefore the vector table used by FreeRTOS is defined in altered easily. Therefore the vector table used by FreeRTOS is defined in
@ -436,58 +443,6 @@ is BAD! */
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void *memcpy(void *pvDest, const void *pvSource, size_t xBytes) {
/* The compiler used during development seems to err unless these volatiles
are included at -O3 optimisation. */
volatile unsigned char *pcDest = (volatile unsigned char *)pvDest,
*pcSource = (volatile unsigned char *)pvSource;
size_t x;
/* Extremely crude standard library implementations in lieu of having a C
library. */
if (pvDest != pvSource) {
for (x = 0; x < xBytes; x++) {
pcDest[x] = pcSource[x];
}
}
return pvDest;
}
/*-----------------------------------------------------------*/
void *memset(void *pvDest, int iValue, size_t xBytes) {
/* The compiler used during development seems to err unless these volatiles
are included at -O3 optimisation. */
volatile unsigned char *volatile pcDest =
(volatile unsigned char *volatile)pvDest;
volatile size_t x;
/* Extremely crude standard library implementations in lieu of having a C
library. */
for (x = 0; x < xBytes; x++) {
pcDest[x] = (unsigned char)iValue;
}
return pvDest;
}
/*-----------------------------------------------------------*/
int memcmp(const void *pvMem1, const void *pvMem2, size_t xBytes) {
const volatile unsigned char *pucMem1 = pvMem1, *pucMem2 = pvMem2;
volatile size_t x;
/* Extremely crude standard library implementations in lieu of having a C
library. */
for (x = 0; x < xBytes; x++) {
if (pucMem1[x] != pucMem2[x]) {
break;
}
}
return xBytes - x;
}
/*-----------------------------------------------------------*/
void vInitialiseTimerForRunTimeStats(void) { void vInitialiseTimerForRunTimeStats(void) {
XScuWdt_Config *pxWatchDogInstance; XScuWdt_Config *pxWatchDogInstance;
uint32_t ulValue; uint32_t ulValue;
@ -536,6 +491,13 @@ void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer,
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory() application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */ to provide the memory that is used by the Timer service task. */
extern "C" {
void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer,
StackType_t **ppxTimerTaskStackBuffer,
uint32_t *pulTimerTaskStackSize);
}
void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer,
StackType_t **ppxTimerTaskStackBuffer, StackType_t **ppxTimerTaskStackBuffer,
uint32_t *pulTimerTaskStackSize) { uint32_t *pulTimerTaskStackSize) {