I was having a problem compiling an Adept 2 project on Ubuntu using GCC. This is the error I'm getting.
Also, here is the code. It's really, really, hacked together but it's just because I couldn't get it working in either Visual Studio 2019 or Linux. I already install the Runtime, SDK, and utilities on both my Windows and Linux machine but to no avail, I still get assembly errors. Any help would be appreciated
#define _CRT_SECURE_NO_WARNINGS
/* ------------------------------------------------------------ *//* Include File Definitions *//* ------------------------------------------------------------ */#if defined(WIN32)/* Include Windows specific headers here.*/#include<windows.h>#else#endif#define DPCAPI
#define DACI_INCLUDED
#include<stdio.h>#include<stdlib.h>#include<string.h>#include"/usr/include/digilent/adept/dpcdecl.h"#include"/usr/include/digilent/adept/dmgr.h"#include"/usr/include/digilent/adept/depp.h"#include"/usr/include/digilent/adept/daci.h"#include"/usr/include/digilent/adept/dpcutil.h"#include"/usr/include/digilent/adept/dpcdefs.h"/* ------------------------------------------------------------ *//* Local Type and Constant Definitions *//* ------------------------------------------------------------ */constint cchSzLen =1024;constint cbBlockSize =1000;/* ------------------------------------------------------------ *//* Global Variables *//* ------------------------------------------------------------ */
BOOL fGetReg;
BOOL fPutReg;
BOOL fGetRegRepeat;
BOOL fPutRegRepeat;
BOOL fDvc;
BOOL fFile;
BOOL fCount;
BOOL fByte;char szDvc[64]="CmodS6";char szAction[cchSzLen];char szRegister[cchSzLen];//char szDvc[cchSzLen];char szFile[cchSzLen];char szCount[cchSzLen];char szByte[cchSzLen];
HIF hif = hifInvalid;FILE* fhin = NULL;FILE* fhout = NULL;/* ------------------------------------------------------------ *//* Local Variables *//* ------------------------------------------------------------ *//* ------------------------------------------------------------ *//* Forward Declarations *//* ------------------------------------------------------------ */
BOOL FParseParam(int cszArg,char* rgszArg[]);voidShowUsage(char* sz);
BOOL FInit();voidErrorExit();voidDoDvcTbl();voidDoPutReg();
BYTE DoGetReg(BYTE idReg[]);voidDoPutRegRepeat();voidDoGetRegRepeat();voidStrcpyS(char* szDst,size_t cchDst,constchar* szSrc);// Making the Error Code pointer
ERC* error;/* ------------------------------------------------------------ *//* Procedure Definitions *//* ------------------------------------------------------------ *//*** main
**
** Synopsis
** int main(cszArg, rgszArg)
**
** Input:
** cszArg - count of command line arguments
** rgszArg - array of command line arguments
**
** Output:
** none
**
** Errors:
** Exits with exit code 0 if successful, else non-zero
**
** Description:
** main function of DEPP Demo application.
*/int main(int cszArg,char* rgszArg[]){//if (!FParseParam(cszArg, rgszArg)) {// ShowUsage(rgszArg[0]);// return 1;//}// First initializing the device, returns false if can't initializeif(!DpcInit(error))return0;// DMGR API Call: DmgrOpenif(!DmgrOpen(&hif, szDvc)){
printf("DmgrOpen failed (check the device name you provided)\n");return0;}// DEPP API call: DeppEnableif(!DeppEnable(hif)){
printf("DeppEnable failed\n");return0;}
BYTE request_bit ={00000000};
BYTE * bit_storage =0;
DWORD value =0;char* choice = NULL;// This is for getting the registers foreverwhile(true){
printf("Please enter the values of bits you'd like to find!");//scanf("%c", choice);
request_bit ={0x0};if(fGetReg){DeppGetReg(hif, request_bit, bit_storage, value);/* Get single byte from register */
printf("%c",value);}}return0;}/* ------------------------------------------------------------ *//*** FParseParam
**
** Parameters:
** cszArg - number of command line arguments
** rgszArg - array of command line argument strings
**
** Return Value:
** none
**
** Errors:
** Returns fTrue if not parse errors, fFalse if command line
** errors detected.
**
** Description:
** Parse the command line parameters and set global variables
** based on what is found.
*/
BOOL FParseParam(int cszArg,char* rgszArg[]){int iszArg;/* Initialize default flag values */
fGetReg = fFalse;
fPutReg = fFalse;
fGetRegRepeat = fFalse;
fPutRegRepeat = fFalse;
fDvc = fFalse;
fFile = fFalse;
fCount = fFalse;
fByte = fFalse;// Ensure sufficient paramaters. Need at least program name, action flag, register numberif(cszArg <3){return fFalse;}/* The first parameter is the action to perform. Copy the
** the first parameter into the action string.
*/StrcpyS(szAction, cchSzLen, rgszArg[1]);if(strcmp(szAction,"-g")==0){
fGetReg = fTrue;}elseif(strcmp(szAction,"-p")==0){
fPutReg = fTrue;}elseif(strcmp(szAction,"-s")==0){
fGetRegRepeat = fTrue;}elseif(strcmp(szAction,"-l")==0){
fPutRegRepeat = fTrue;}else{// unrecognized actionreturn fFalse;}/* Second paramater is target register on device. Copy second
** paramater to the register string */StrcpyS(szRegister, cchSzLen, rgszArg[2]);/* Parse the command line parameters.
*/
iszArg =3;while(iszArg < cszArg){/* Check for the -d parameter which is used to specify
** the device name of the device to query.
*/if(strcmp(rgszArg[iszArg],"-d")==0){
iszArg +=1;if(iszArg >= cszArg){return fFalse;}StrcpyS(szDvc, cchSzLen, rgszArg[iszArg++]);
fDvc = fTrue;}/* Check for the -f parameter used to specify the
** input/output file name.
*/elseif(strcmp(rgszArg[iszArg],"-f")==0){
iszArg +=1;if(iszArg >= cszArg){return fFalse;}StrcpyS(szFile, cchSnMax, rgszArg[iszArg++]);
fFile = fTrue;}/* Check for the -c parameter used to specify the
** number of bytes to read/write from file.
*/elseif(strcmp(rgszArg[iszArg],"-c")==0){
iszArg +=1;if(iszArg >= cszArg){return fFalse;}StrcpyS(szCount, cchUsrNameMax, rgszArg[iszArg++]);
fCount = fTrue;}/* Check for the -b paramater used to specify the
** value of a single data byte to be written to the register
*/elseif(strcmp(rgszArg[iszArg],"-b")==0){
iszArg +=1;if(iszArg >= cszArg){return fFalse;}StrcpyS(szByte, cchUsrNameMax, rgszArg[iszArg++]);
fByte = fTrue;}/* Not a recognized parameter
*/else{return fFalse;}}// End while/* Input combination validity checks
*/if(!fDvc){
printf("Error: No device specified\n");return fFalse;}if(fPutReg &&!fByte){
printf("Error: No byte value provided\n");return fFalse;}if((fGetRegRepeat || fPutRegRepeat)&&!fFile){
printf("Error: No filename provided\n");return fFalse;}return fTrue;}/* ------------------------------------------------------------ *//*** ShowUsage
**
** Synopsis
** VOID ShowUsage(sz)
**
** Input:
** szProgName - program name as called
**
** Output:
** none
**
** Errors:
** none
**
** Description:
** prints message to user detailing command line options
*/voidShowUsage(char* szProgName){
printf("\nDigilent DEPP demo\n");
printf("Usage: %s <action> <register> -d <device name> [options]\n", szProgName);
printf("\n\tActions:\n");
printf("\t-g\t\t\t\tGet register byte\n");
printf("\t-p\t\t\t\tPut Register byte\n");
printf("\t-l\t\t\t\tStream file into register\n");
printf("\t-s\t\t\t\tStream register into file\n");
printf("\n\tOptions:\n");
printf("\t-f <filename>\t\t\tSpecify file name\n");
printf("\t-c <# bytes>\t\t\tNumber of bytes to read/write\n");
printf("\t-b <byte>\t\t\tValue to load into register\n");
printf("\n\n");}/* ------------------------------------------------------------ *//*** StrcpyS
**
** Parameters:
** szDst - pointer to the destination string
** cchDst - size of destination string
** szSrc - pointer to zero terminated source string
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** Cross platform version of Windows function strcpy_s.
*/voidStrcpyS(char* szDst,size_t cchDst,constchar* szSrc){#if defined (WIN32)
strcpy_s(szDst, cchDst, szSrc);#elseif(0< cchDst){
strncpy(szDst, szSrc, cchDst -1);
szDst[cchDst -1]='\0';}#endif}/* ------------------------------------------------------------ *//************************************************************************/
Question
k16blfurm
Hey Everyone,
I was having a problem compiling an Adept 2 project on Ubuntu using GCC. This is the error I'm getting.
Also, here is the code. It's really, really, hacked together but it's just because I couldn't get it working in either Visual Studio 2019 or Linux. I already install the Runtime, SDK, and utilities on both my Windows and Linux machine but to no avail, I still get assembly errors. Any help would be appreciated
Â
Â
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.