diff --git a/dx_pwr_basic/vitis_classic_autobuild/config.json b/dx_pwr_basic/vitis_classic_autobuild/config.json index 5459b9a..eb8c166 100644 --- a/dx_pwr_basic/vitis_classic_autobuild/config.json +++ b/dx_pwr_basic/vitis_classic_autobuild/config.json @@ -1,6 +1,18 @@ { - "project_name": "dx_sig", + "project_name": "dx_pwr", "version": "1.1.0", "hw_design": "../system_top.xsa", - "hw_version": "dx_sig-HW-1.1.0" + "hw_version": "dx_pwr-HW-1.1.0", + "apps": { + "app_hello": { + "sources": ["source/"], + "target_cpu": "ps7_cortexa9_0", + "os": "standalone", + "language": "C", + "mem_layout" : { + "heap_size": "0x80000", + "stack_size": "0x4000" + } + } + } } diff --git a/dx_pwr_basic/vitis_classic_autobuild/source/helloworld.c b/dx_pwr_basic/vitis_classic_autobuild/source/helloworld.c new file mode 100644 index 0000000..6989c9e --- /dev/null +++ b/dx_pwr_basic/vitis_classic_autobuild/source/helloworld.c @@ -0,0 +1,33 @@ +/****************************************************************************** +* Copyright (C) 2023 Advanced Micro Devices, Inc. All Rights Reserved. +* SPDX-License-Identifier: MIT +******************************************************************************/ +/* + * helloworld.c: simple test application + * + * This application configures UART 16550 to baud rate 9600. + * PS7 UART (Zynq) is not initialized by this application, since + * bootrom/bsp configures it to baud rate 115200 + * + * ------------------------------------------------ + * | UART TYPE BAUD RATE | + * ------------------------------------------------ + * uartns550 9600 + * uartlite Configurable only in HW design + * ps7_uart 115200 (configured by bootrom/bsp) + */ + +#include +#include "platform.h" +#include "xil_printf.h" + + +int main() +{ + init_platform(); + + print("Hello World\n\r"); + print("Successfully ran Hello World application"); + cleanup_platform(); + return 0; +} diff --git a/dx_pwr_basic/vitis_classic_autobuild/source/platform.c b/dx_pwr_basic/vitis_classic_autobuild/source/platform.c new file mode 100644 index 0000000..fc0d17c --- /dev/null +++ b/dx_pwr_basic/vitis_classic_autobuild/source/platform.c @@ -0,0 +1,86 @@ +/****************************************************************************** +* Copyright (C) 2023 Advanced Micro Devices, Inc. All Rights Reserved. +* SPDX-License-Identifier: MIT +******************************************************************************/ + +#include "xparameters.h" +#include "xil_cache.h" + +#ifndef SDT +#include "platform_config.h" +#endif + +/* + * Uncomment one of the following two lines, depending on the target, + * if ps7/psu init source files are added in the source directory for + * compiling example outside of SDK. + */ +/*#include "ps7_init.h"*/ +/*#include "psu_init.h"*/ + +#ifdef STDOUT_IS_16550 + #include "xuartns550_l.h" + + #define UART_BAUD 9600 +#endif + +void +enable_caches() +{ +#ifdef __PPC__ + Xil_ICacheEnableRegion(CACHEABLE_REGION_MASK); + Xil_DCacheEnableRegion(CACHEABLE_REGION_MASK); +#elif __MICROBLAZE__ +#ifdef XPAR_MICROBLAZE_USE_ICACHE + Xil_ICacheEnable(); +#endif +#ifdef XPAR_MICROBLAZE_USE_DCACHE + Xil_DCacheEnable(); +#endif +#endif +} + +void +disable_caches() +{ +#ifdef __MICROBLAZE__ +#ifdef XPAR_MICROBLAZE_USE_DCACHE + Xil_DCacheDisable(); +#endif +#ifdef XPAR_MICROBLAZE_USE_ICACHE + Xil_ICacheDisable(); +#endif +#endif +} + +void +init_uart() +{ +#ifdef STDOUT_IS_16550 + XUartNs550_SetBaud(STDOUT_BASEADDR, XPAR_XUARTNS550_CLOCK_HZ, UART_BAUD); + XUartNs550_SetLineControlReg(STDOUT_BASEADDR, XUN_LCR_8_DATA_BITS); +#endif + /* Bootrom/BSP configures PS7/PSU UART to 115200 bps */ +} + +void +init_platform() +{ + /* + * If you want to run this example outside of SDK, + * uncomment one of the following two lines and also #include "ps7_init.h" + * or #include "ps7_init.h" at the top, depending on the target. + * Make sure that the ps7/psu_init.c and ps7/psu_init.h files are included + * along with this example source files for compilation. + */ + /* ps7_init();*/ + /* psu_init();*/ + enable_caches(); + init_uart(); +} + +void +cleanup_platform() +{ + disable_caches(); +} diff --git a/dx_pwr_basic/vitis_classic_autobuild/source/platform.h b/dx_pwr_basic/vitis_classic_autobuild/source/platform.h new file mode 100644 index 0000000..b6119e6 --- /dev/null +++ b/dx_pwr_basic/vitis_classic_autobuild/source/platform.h @@ -0,0 +1,16 @@ +/****************************************************************************** +* Copyright (C) 2023 Advanced Micro Devices, Inc. All Rights Reserved. +* SPDX-License-Identifier: MIT +******************************************************************************/ + +#ifndef __PLATFORM_H_ +#define __PLATFORM_H_ + +#ifndef SDT +#include "platform_config.h" +#endif + +void init_platform(); +void cleanup_platform(); + +#endif diff --git a/dx_pwr_basic/vitis_classic_autobuild/source/platform_config.h b/dx_pwr_basic/vitis_classic_autobuild/source/platform_config.h new file mode 100644 index 0000000..eda2e2e --- /dev/null +++ b/dx_pwr_basic/vitis_classic_autobuild/source/platform_config.h @@ -0,0 +1,6 @@ +#ifndef __PLATFORM_CONFIG_H_ +#define __PLATFORM_CONFIG_H_ + +#define STDOUT_IS_PS7_UART +#define UART_DEVICE_ID 0 +#endif