News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

C++ Program using Function Pointer not running in Microblaze

Started by Deepak, November 19, 2021, 01:21:39 AM

Previous topic - Next topic

Deepak

Hello,

I am writing a simple program with templates and function pointer in Vitis 2019.2 to run on the Microblaze. I instantiated a Microblaze and BRAM in the hardware.
The program is compiling without any errors but result is not stored on the memory. I ran the same program on my local desktop and it is running as expected.

Can someone please help me on how to debug this issue?

I have posted the program below.

Thanks for your time and consideration.

#include "xil_io.h"
#include "xparameters.h"
#include <functional>

int AddFunc(int a, int b, int c){
     int ans = a + b + c;
     return ans;
}

template <typename T, typename... ArgTypes>
class FuncExec{
     const std::function<T(ArgTypes...)> f_;
     T value;

public:
     FuncExec(const std::function<T(ArgTypes...)> f) : f_(f) {}

     void FuncInput(ArgTypes... args){
          value = f_(args...);
          Xil_Out64(XPAR_AXI_BRAM_CTRL_1_S_AXI_BASEADDR + sizeof(double) + sizeof(double), value);
     }
};

int main() {
     FuncExec <int, int, int, int> func1(AddFunc);
     func1.FuncInput(3, 3, 3);
     return 0;
}

JH

Hi,
I didn't work with C++ and Xilinx vitis. So I can't help much on this problem.
Maybe you should write one time to Xilinx forum because this is a more general question and xilinx community is much bigger .

br
John