Altera_Forum
Honored Contributor
15 years agoNios II SBT(CLI) issue with C2H compilation flow
Hello,
I am having some problems when using the C2H as part of the Nios II SBT tool chain (using command line tools). First of all a little bit of context: the project it self is very simple, DE2-70 board with Cyclone II FPGA, standard SoPC configuration, and a single-file application. Application source pseudo-code:
void intensive_function(int *a, int *b, int *result)
{
int i, t;
// process arrays a & b to derive and store result
for (i=0;i<SIZE;i++) t += a - b;
*result = t
}
int main()
{
int *a, *b, result;
// allocate a & b
intensive_function(a, b, &result); // compute
}
First of all, let me say that this works absolutely fine if I use the Nios II IDE and manually create the accellerator etc, using the GUI tools. But as that is a legacy approach I want to move to SBT w/ CLI design flow. When using the SBT but WITHOUT enabling the C2H compiler path it also compiles and executes correctly. This is how I generated and built the project (labelled 'test' & bsp 'test_bsp'): # create BSP, update settings, and generate nios2-bsp hal ../test_bsp ../../DE2_70_SOPC.sopcinfo nios2-bsp-update-settings --settings ../test_bsp/settings.bsp --set hal.timestamp_timer timer_stamp # create application makefile nios2-app-generate-makefile --bsp-dir=../test_bsp --src-dir=. --set QUARTUS_PROJECT_DIR=../../../ --elf-name test.elf --set OBJDUMP_INCLUDE_SOURCE 1 # build make Using this process all is well. Now, according to the SBT manuals, invoking the C2H compiler (on the 'intensive_function' method should be a straight forward affair): # create application makefile nios2-app-generate-makefile --bsp-dir=../test_bsp --src-dir=. --set QUARTUS_PROJECT_DIR=../../../ --elf-name test.elf --set OBJDUMP_INCLUDE_SOURCE 1 --c2h # generate c2h makefile nios2-c2h-generate-makefile --sopc=../../DE2_70_SOPC.sopcinfo --accelerator=intensive_function,main.c,1,1 --enable_quartus=1 # build make Unfortunately this does not work well at all. There are several side-effects but I'm not sure exactly what part causes the problems: 1) Quartus can't synthesise the project CPU .v instantiation files due to missing PLLs.. this can be edited and then the system will compile 2) However now the BSP needs to be regenerated due to SoPC config changes 3) When launching SoPCBuilder there are numerous warnings and you can see the generated accelerator component is unconnected! I can then resolve these and reconnect the component, and regenerate the system 4) Can then recreate the BSP, and rebuild the project 5) However the .elf file failes to download correctly with this errorr: Downloaded 65KB in 1.1s (59.0KB/s) Verifying 04000000 ( 0%) Verify failed between address 0x4000000 and 0x400FFFB It looks like this is probably due to a hardware fault in the generated/synthesised image? Can anyone shed some light into these issues?, Or if you have successfully been able to build, synthesise, and run a C2H project using the CLI tools please let me know your build process! :cool: