Jump to content
  • 0

C++ Program using Function Pointer not running in Microblaze




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;


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;


Edited by dpk
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...