| Subject: | Re: Questions according to ReconOS |
|---|---|
| Date: | Mon, 7 Nov 2016 23:05:36 +0100 |
| From: | Christoph Rüthing <chri...@muppetnet.net> |
| To: | zakaria gue <gue...@gmail.com> |
Hey Christoph,
For the message XDEVCFG---DONE, i include printf inside the function loadbitstream, to verified
Finally i have fix the issues, is that after verification of xdevcfg manually , i don't find it, and based on your explications, i find that i not use the correct linux version, back to guide on the homepage i install the correct kernel, and every thing is work now,
Other question, how that reconos divide the fpga in slots, is that equal space. if want more slots i add num of reconf, and of course the size become small, if i want to modifier the size where i can do that
I would like to thank you for your time, and sorry to disturb you,
Best,
Zakarya
2016-11-03 23:03 GMT+01:00 Christoph Rüthing <chri...@muppetnet.net>:
Hi Zakarya,
I am a little bit uncertain about what exact steps you have performed and where the XDEVCFG ----- DONE output comes from.
At first, reconos_download_bitstream works totally different than the partial reconfiguration performed at runtime. Furthermore, you do not use the partial bitstreams in reconos_download_bitstream.
Basically, you need to perform the following steps:
- Program a complete bitstream into the FPGA, for example the idle one. This can be done using JTAG or also via the xdevcfg device. This complete bitstream contains the static logic parts which are not reconfigured, since ReconOS programs only the partial bitstreams for the different hardware slots at runtime and not the entire bitstream.
- After that, you should be able to use the system with regular hardware threads, i.e. not reconfigurable ones.
- You could also use your reconfigurable threads which will program the partial bitstreams at runtime when a thread is scheduled. This is done via the xdevcfg device provided by the drivers already included in Linux. If you see that device at /dev/xdevcfg and /sys/class/xdevcfg everything should be fine. You should also see the driver loading at boot or in the kernel log via dmesg.
So, to narrow down the problem you should try if you can program a partial bitstream via xdevcfg by hand. Therefore, program the FPGA with a complete bitstream in the first step. Then configure the xdevcfg device for partial bitstreams by writing ‘1’ to /sys/class/xdevcfg/xdevcfg/device/is_partial_bitstream and simply cat the .bin to /dev/xdevcfg. If that works without crashing your system and returning ‘1’ in /sys/class/xdevcfg/xdevcfg/device/prog_done, everything seems to be fine. Just a note for that, the partial bitstreams must be copied from the reconos_reconf/bin folder created by the reconos_build_reconf script, since the endianess must be switched for usage with the xdevcfg device.
If that works ReconOS should also be able to program the partial bitsreams correctly. From the output in your screenshot that seems to work, since there were no errors. However, I am unsure for what reason you suspect an error with the programming.
Maybe you can send me your code and completr output you receive so that I can take a closer look at it.
Btw, have you setup linux using the guide on the homepage?
Yours,
Christoph
Von: zakaria gue
Gesendet: Donnerstag, 3. November 2016 11:27
An: Christoph Rüthing
Betreff: Re: Questions according to ReconOS
zakaria gue <gue...@gmail.com> hat am 3. November 2016 um 11:27 geschrieben:
2016-11-03 11:24 GMT+01:00 zakaria gue <gue...@gmail.com>:
Hi Christoph,
I really apparition your reply so fast, thanks very much,
In the first i make my example based on reconf_sort_matrix, but i use nfs,
I do all change that you told me to do and still not work,
i debug on every level until xdevcfg see screenshot
but the bitstream still not loaded
Manually using reconos_download_bitstream, to be sure that the bitstream work correctly.
Question : should i load idle bitstream in the first.
Maybe an issue is that my device tree not contain the dma part, in this is related with PCAP.
Cheers,
Zakarya
2016-11-02 20:56 GMT+01:00 Christoph Rüthing <chri...@muppetnet.net>:
Hi Zakarya,
happy to hear that you are working with ReconOS and that it is working so far.
Generally, your approach seems to be quite right. However, there are some points that are not correct right now.
1)
The way you are initializing the configurations in the first part seems to be totally correct. Basically, the sequence to perform is _init, _setresources and _loadbitstream.
2)
After you have initialized your configurations, you can use them to create an actual hardware thread by hwt_create_reconf. However, there is no need for _setbitstream. This method is an alternative to the _loadbitstream you can use when you already have the bitstream in memory._loadbitstream does exactly the same but loads the bitstream from a file initially (see https://github.com/ReconOS/reconos/blob/master/lib/reconos.h#L119). Therefore, the hardware thread should start as soon as you call hwt_create_reconf.
3)
The scheduler is used to change the configuration executed in the hardware thread and is called whenever the thread yields (see https://github.com/ReconOS/reconos/blob/master/lib/reconos.h#L243). What the scheduler does is basically user defined and the only thing you need to do is to return the configuration you want to have scheduled next. You do not need to perform any creation or loading, especially you do not need to call hwt_create_reconf or _setbitstream. All the reconfiguration should be performed automatically by ReconOS. What looks a little bit suspicious in your example is the mutex_unlock, since you do not have no mutex_lock before.
4)
You also need to set the function pointer to you scheduler by set_scheduler and also need to call reconos_init before creating the hardware threads by _hwt_create_reconf.
For an example you can take a look into the sort demo application (see https://github.com/ReconOS/reconos/blob/master/demos/reconf_sort_matrix/linux/reconf_sort_matrix.c#L182) where all the operations described above are implemented.
If it is really an issue with loading of the bitstreams, you could, at first, verify that the bitstreams are loaded correctly or why they are not loaded correctly. There is no magic happening there, the filename you pass to _loadbitstream is just used as it is to open the bitstream (see https://github.com/ReconOS/reconos/blob/master/lib/reconos.c#L64). Therefore, you need to make sure that the file is named exactly like that and is located in the current working directory of the process (keep in mind, that the current working directory is the directory you are executing the program from, i.e. if you call it by demos/a.out the working directory is not demos/ but ./ and it tries to load ./system_hwt_reconf_0_hwt_sort_demo_partial.bin and not demos/system_hwt_Reconf_0_hwt_sort_demo_partial.bin). If you want to debug this you can simply change the source of the reconos.c, ... and add printf as it helps. Btw, what do you mean by "when i load it manually it work"?
Yours,
Christoph
P.S. Would it be okay for you if I forward our conversation to the ReconOS mailing-list? Probably it is also of interest for others.
On 11/02/2016 09:37 AM, zakaria gue wrote:
Hey Christoph,
Introducing myself i am Zakarya GUETTATFI a PhD student from Algeria, i working on ReconOS.
I have question concerning Partial reconfiguration,
I follow this step :
1- Create EDK-Project by reconos_setup script.
2- Execute reconos_build_reconf script inside EDK-Project.
3- Copy the bin files into the filesystem using nfs.
I create my demo based on the demo of sort and matrix multiplication content two hardware threads and one reconf-region .
After that i flash the one of my thread using :for (i = 0; i < NUM_HWT; i++) {
reconos_configuration_init(&sort_cfg[i], "sort", i);
reconos_configuration_setresources(&sort_cfg[i], sort_res, 2);
snprintf(filename, sizeof(filename), "system_hwt_reconf_%d_hwt_sort_demo_partial.bin", i);
reconos_configuration_loadbitstream(&sort_cfg[i], filename);
reconos_configuration_init(&mmul_cfg[i], "mmul", i);
reconos_configuration_setresources(&mmul_cfg[i], mmul_res, 2);
snprintf(filename, sizeof(filename), "system_hwt_reconf_%d_hwt_matrixmul_partial.bin", i);
reconos_configuration_loadbitstream(&mmul_cfg[i], filename);
}
reconos_configuration_setbitstream(&sort_cfg[0],&sort_cfg[0].bitstream,&sort_cfg[0].bitstream_length);
reconos_hwt_create_reconf(&hwt[0], i, &sort_cfg[0], NULL);
but it doesn't work (not load bin file from file-system), when i load it manually it work, i set a scheduler
struct reconos_configuration *schedule(struct reconos_hwt *hwt) {
k++;
printf("-------------Schedule %i ------------- \n",k);
printf(" State : %i \n",hwt->state);
if (!strcmp("mmul", hwt->cfg->name)) {
printf("--Check%i %s... \n",k,hwt->cfg->name);
printf("Replacing mmul by sort now\n");
reconos_configuration_setbitstream(&sort_cfg[0],&sort_cfg[0].bitstream,&sort_cfg[0].bitstream_length);
// reconos_hwt_create_reconf(&hwt[0], 0, &sort_cfg[0], NULL); I don't know that is necessary but any way nothing change
return &sort_cfg[hwt->slot];
}
else if (!strcmp("sort", hwt->cfg->name)) {
printf("--Check%i %s... \n",k,hwt->cfg->name);
printf("Replacing sort by mmul now\n");
pthread_mutex_unlock(&sched_mutex);
reconos_configuration_setbitstream(&mmul_cfg[0],&mmul_cfg[0].bitstream,&mmul_cfg[0].bitstream_length);
// reconos_hwt_create_reconf(&hwt[0], 0, &mmul_cfg[0], NULL);
return &mmul_cfg[hwt->slot];
}
}
My issue is that every thing is work fine, but the thread not change, the scheduler not load a the bitstream
And the nothing appear strong when i debug.
Could help me. Thank you
Cheers,
Zakarya