kiml / psoc_programmer Goto Github PK
View Code? Open in Web Editor NEWOpen source Unix (Linux/Mac) tools to manipulate hex files and program a PSoC5 via FX2 USB interface (assumes CY8CKIT-050)
License: Other
Open source Unix (Linux/Mac) tools to manipulate hex files and program a PSoC5 via FX2 USB interface (assumes CY8CKIT-050)
License: Other
On fresh checkout it gives following error:
cube Desktop # gc https://github.com/kiml/PSOC_programmer
Cloning into 'PSOC_programmer'...
remote: Counting objects: 74, done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 74 (delta 4), reused 65 (delta 3)
Unpacking objects: 100% (74/74), done.
Checking connectivity... done.
cube Desktop # cd PSOC_programmer/
cube PSOC_programmer # make
for dir in src; do \
make -C $dir all; \
done
make[1]: Entering directory `/root/Desktop/PSOC_programmer/src'
Make all in subdir: libhex
make[2]: Entering directory `/root/Desktop/PSOC_programmer/src/libhex'
make[2]: *** No rule to make target `all'. Stop.
make[2]: Leaving directory `/root/Desktop/PSOC_programmer/src/libhex'
Make all in subdir: libini
make[2]: Entering directory `/root/Desktop/PSOC_programmer/src/libini'
g++ -c INIReader.cpp
g++ -c HierINIReader.cpp
In file included from HierINIReader.cpp:7:0:
HierINIReader.h:17:5: error: ‘uint32_t’ does not name a type
uint32_t GetUint32(std::string section, std::string name, uint32_t default_value);
^
HierINIReader.cpp:35:1: error: ‘uint32_t’ does not name a type
uint32_t HierINIReader::GetUint32(string section, string name, uint32_t default_value)
^
make[2]: *** [HierINIReader.o] Error 1
make[2]: Leaving directory `/root/Desktop/PSOC_programmer/src/libini'
Make all in subdir: programmer
make[2]: Entering directory `/root/Desktop/PSOC_programmer/src/programmer'
g++ -I ../libhex -I ../libini -c prog.cpp
prog.cpp: In function ‘void parse_args(int*, char***, config_s*)’:
prog.cpp:170:46: error: ‘getopt’ was not declared in this scope
while ((ch = getopt(*argc, *argv, "hC:d:")) != -1)
^
prog.cpp:175:38: error: ‘optarg’ was not declared in this scope
config->config_dir = optarg;
^
prog.cpp:189:14: error: ‘optind’ was not declared in this scope
*argc -= optind;
^
make[2]: *** [prog.o] Error 1
make[2]: Leaving directory `/root/Desktop/PSOC_programmer/src/programmer'
Make all in subdir: tools
make[2]: Entering directory `/root/Desktop/PSOC_programmer/src/tools'
g++ -I ../libhex -I ../programmer -L ../libhex -lhex hex2bin.cpp -o hex2bin
/usr/bin/ld: cannot find -lhex
collect2: error: ld returned 1 exit status
make[2]: *** [hex2bin] Error 1
make[2]: Leaving directory `/root/Desktop/PSOC_programmer/src/tools'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/Desktop/PSOC_programmer/src'
make: *** [all] Error 2
After making libhex seperately, it gives following error:
cube PSOC_programmer # make
for dir in src; do \
make -C $dir all; \
done
make[1]: Entering directory `/root/Desktop/PSOC_programmer/src'
Make all in subdir: libhex
make[2]: Entering directory `/root/Desktop/PSOC_programmer/src/libhex'
make[2]: *** No rule to make target `all'. Stop.
make[2]: Leaving directory `/root/Desktop/PSOC_programmer/src/libhex'
Make all in subdir: libini
make[2]: Entering directory `/root/Desktop/PSOC_programmer/src/libini'
g++ -c HierINIReader.cpp
In file included from HierINIReader.cpp:7:0:
HierINIReader.h:17:5: error: ‘uint32_t’ does not name a type
uint32_t GetUint32(std::string section, std::string name, uint32_t default_value);
^
HierINIReader.cpp:35:1: error: ‘uint32_t’ does not name a type
uint32_t HierINIReader::GetUint32(string section, string name, uint32_t default_value)
^
make[2]: *** [HierINIReader.o] Error 1
make[2]: Leaving directory `/root/Desktop/PSOC_programmer/src/libini'
Make all in subdir: programmer
make[2]: Entering directory `/root/Desktop/PSOC_programmer/src/programmer'
g++ -I ../libhex -I ../libini -c prog.cpp
prog.cpp: In function ‘void parse_args(int*, char***, config_s*)’:
prog.cpp:170:46: error: ‘getopt’ was not declared in this scope
while ((ch = getopt(*argc, *argv, "hC:d:")) != -1)
^
prog.cpp:175:38: error: ‘optarg’ was not declared in this scope
config->config_dir = optarg;
^
prog.cpp:189:14: error: ‘optind’ was not declared in this scope
*argc -= optind;
^
make[2]: *** [prog.o] Error 1
make[2]: Leaving directory `/root/Desktop/PSOC_programmer/src/programmer'
Make all in subdir: tools
make[2]: Entering directory `/root/Desktop/PSOC_programmer/src/tools'
g++ -I ../libhex -I ../programmer -L ../libhex -lhex hex2bin.cpp -o hex2bin
/tmp/ccXY540P.o: In function `main':
hex2bin.cpp:(.text+0x6e): undefined reference to `HexData::HexData()'
hex2bin.cpp:(.text+0x86): undefined reference to `HexData::read_hex(char const*, unsigned int)'
hex2bin.cpp:(.text+0xd5): undefined reference to `HexData::dump(_IO_FILE*, int) const'
hex2bin.cpp:(.text+0xf9): undefined reference to `HexData::minmax_address(unsigned int, unsigned int, unsigned int*, unsigned int*) const'
hex2bin.cpp:(.text+0x154): undefined reference to `HexData::extract2bin(unsigned int, unsigned int, unsigned char*) const'
hex2bin.cpp:(.text+0x1d4): undefined reference to `HexData::minmax_address(unsigned int, unsigned int, unsigned int*, unsigned int*) const'
collect2: error: ld returned 1 exit status
make[2]: *** [hex2bin] Error 1
make[2]: Leaving directory `/root/Desktop/PSOC_programmer/src/tools'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/Desktop/PSOC_programmer/src'
make: *** [all] Error 2
cube PSOC_programmer #
After compiling on OSX (thanks to the other user for the hint on adding an include to getopt.h - it seems the main repository doesn't include the fit yet), I get an error when attempting to load a hex file. It seems like it can't find the .dev and .ini files. I'm not sure how to point to them - they are in a folder called config, and I've tried that folder living one level up from /bin and also inside /bin and neither worked.
$ ./prog program testfile_1.hex
Device Name not specified
Failed to read device config
Also, thanks for this work! I am hoping I can get it working so I will have a simple way to program hex files onto the CY8Ckit-059 (possibly compatible? can't tell if it uses the same kitprog IC) using a Mac for teaching purposes with students who don't have Windows machines.
One cannot expect optind to approach argc. On GNU/Linux:
The following will hang because getopt will, by default, permute argv such that options are in front and nonoptions are at the end of argv.
$ ../../PSOC_programmer/bin/mergehex -nm ../../PSOC_compiler/../PSOC_programmer/config/nm.hex -c demo_tmp.hex > demo.hex
Setting POSIXLY_CORRECT functions as a workaround and mergehex will run just fine.
$ POSIXLY_CORRECT=1 ../../PSOC_programmer/bin/mergehex -nm ../../PSOC_compiler/../PSOC_programmer/config/nm.hex -c demo_tmp.hex > demo.hex
Relevant paragraph from man 3 getopt
By default, getopt() permutes the contents of argv as it scans, so
that eventually all the nonoptions are at the end. Two other modes
are also implemented. If the first character of optstring is '+' or
the environment variable POSIXLY_CORRECT is set, then option process‐
ing stops as soon as a nonoption argument is encountered. If the
first character of optstring is '-', then each nonoption argv-element
is handled as if it were the argument of an option with character code
- (This is used by programs that were written to expect options and
other argv-elements in any order and that care about the ordering of
the two.) The special argument "--" forces an end of option-scanning
regardless of the scanning mode.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.