diff --git a/AUTHORS b/AUTHORS index 5c5b1bd..eb1ccb5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1 @@ -https://sourceforge.net/projects/cctool/ \ No newline at end of file +George Stark george-u@yandex.com diff --git a/ChangeLog b/ChangeLog index 81f0d79..caa3991 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,4 +15,7 @@ 03/12/2012 version 0.16 * fixed CC debugger device USB PID value +06/06/2012 version 0.18 + * fixed wrong CC111x identification + * added reference in linux man pages format diff --git a/Makefile.am b/Makefile.am index 58d36a4..1bd9598 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1,3 @@ -SUBDIRS=src +SUBDIRS = src ACLOCAL_AMFLAGS = -I m4 +man_MANS = man/cc-tool.1 diff --git a/Makefile.in b/Makefile.in index 2a97771..0e86d6e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -59,6 +59,31 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" +NROFF = nroff +MANS = $(man_MANS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ @@ -244,6 +269,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src ACLOCAL_AMFLAGS = -I m4 +man_MANS = man/cc-tool.1 all: all-recursive .SUFFIXES: @@ -290,6 +316,44 @@ clean-libtool: distclean-libtool: -rm -f libtool config.lt +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" + @list=''; test -n "$(man1dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + test -z "$$files" || { \ + echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -427,6 +491,19 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -603,9 +680,12 @@ distcleancheck: distclean exit 1; } >&2 check-am: all-am check: check-recursive -all-am: Makefile +all-am: Makefile $(MANS) installdirs: installdirs-recursive installdirs-am: + for dir in "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -653,7 +733,7 @@ info: info-recursive info-am: -install-data-am: +install-data-am: install-man install-dvi: install-dvi-recursive @@ -669,7 +749,7 @@ install-info: install-info-recursive install-info-am: -install-man: +install-man: install-man1 install-pdf: install-pdf-recursive @@ -699,7 +779,9 @@ ps: ps-recursive ps-am: -uninstall-am: +uninstall-am: uninstall-man + +uninstall-man: uninstall-man1 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive @@ -713,12 +795,13 @@ uninstall-am: dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-man uninstall-man1 # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/README b/README index 8cd7a33..186d2bd 100644 --- a/README +++ b/README @@ -1,88 +1,21 @@ -cc-tool provides support of Texas Instruments CC Debugger and -some evolution boards to program TI 8051-based System-On-Chip devices +#### cc-tool version 0.18 +cc-tool provides support for Texas Instruments CC Debugger -The software has been tested on SmartRF05 Evaluation Board only -(firmware version: 0005, revision 0009 and 0019) -Reported corrected working with CC debugegr firmware revision 0025 +#### Project home: +http://sourceforge.net/projects/cctool/ -In order to work with the board using non-privileged account add this line -to udev rules: +#### Building from source, dependencies: +Ubuntu 11.10: libusb-1.0, libboost-all-dev, +Fedora 13-16: boost-devel, libusb1-devel -# SmartRF05 Evaluation Board -ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a0", MODE="0666" +#### User guide: +man cc-tool -# SmartRF04 Evaluation Board -ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="11a0", ATTRS{idProduct}=="db20", MODE="0666" +#### Additional: +File udev/90-cc-debugger.rules cotains udev rules changing permissions +for TI CC Debugger device and TI evolution boards so they can be used +from non-privileged accounts. Copy it to /etc/udev/rules.d -# CC Debugger -ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a2", MODE="0666" - -Building from sources was tested on Fedora 13-16, Ubuntu 11.10 -Packages for building: Ubuntu: libusb-1.0, libboost-all-dev, Fedora: boost-devel, libusb1-devel - -Currently next chips are supported: -Supported chips (* - tested): -CC2540 CC2530* CC2531* CC2533 CC2430 CC2431 CC2510 CC2511* CC1110 CC1111 - - -Command line options: - - -h, --help - produce help message - - -d, --device 'bus_number:device_number' - set programmer device usb address. The option is useful if more than one - debugger connected to the system simultaneously. - - -f, --fast - set fast debug interface speed (by default: slow) - - -i, --read-info-page [file_name] - read target info page. If no file-name provided data will be printed to - console - - -a, --read-mac-address - read target's mac address(es) - - -r, --read file_name - read flash memory to the specified file - - -e, --erase - erase flash memory completely and reset lock bits - - -w, --write file_name - write flash memory. Option can be specified several times to build composite - flash image or apply patches - - -v, --verify - verify flash after writing - - --reset - perform target reset - - -t, --test - only search for programmer and target and print various information - - -n, --name target_name - specify target name e.g. CC2530 etc. If specified target does not match - detected one no operation is performed. Option is not required - - -l, --lock lock_data - specify lock data in hex numbers. Lock data size must be exactly - 1 byte (2 hex digits) or 16 bytes (32 hex digits) depend on target. - For several targets lock data can be placed into flash image file - -'file_name' format: [path\]file_name[,[format][,offset]] -format can be 'hex' (Intel hex) or 'binary'. Format field can be omitted if file -extension is hex or bin. Offset value (in decimal) is an absolute target flash -address and is supported only for binary files and only for write operation. - -Examples: - -cc_tool --name cc2530 --write image.hex --write patch.bin,,80 -cc_tool --read image.bin - -Verification is implemented by calculating crc-16 of 1 Kb flash blocks by means -of target itself. After writing is completed target is configured to calculate -CRC-16 over own flash and send out results to the cc-tool where it is compared -to the input flash image. This method is much faster against read out all flash data. +#### Bug reports: +If you found a bug try to reproduce it added command line option --log and +send the log file along with problem description to george-u@yandex.com diff --git a/configure b/configure index 9f4cfc8..c59a902 100755 --- a/configure +++ b/configure @@ -1,6 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.66 for cc-tool 0.13. +# Generated by GNU Autoconf 2.66 for cc-tool 0.18. +# +# Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -236,10 +238,11 @@ fi $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: george-u@yandex.com about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." fi exit 1 fi @@ -559,9 +562,9 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cc-tool' PACKAGE_TARNAME='cc-tool' -PACKAGE_VERSION='0.13' -PACKAGE_STRING='cc-tool 0.13' -PACKAGE_BUGREPORT='' +PACKAGE_VERSION='0.18' +PACKAGE_STRING='cc-tool 0.18' +PACKAGE_BUGREPORT='george-u@yandex.com' PACKAGE_URL='' # Factoring default headers for most tests. @@ -609,6 +612,9 @@ DEPS_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG +BOOST_THREAD_LIBS +BOOST_THREAD_LDPATH +BOOST_THREAD_LDFLAGS BOOST_REGEX_LIBS BOOST_REGEX_LDPATH BOOST_REGEX_LDFLAGS @@ -666,6 +672,14 @@ CPPFLAGS LDFLAGS CFLAGS CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build LIBTOOL am__untar am__tar @@ -690,18 +704,6 @@ am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build target_alias host_alias build_alias @@ -1313,7 +1315,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cc-tool 0.13 to adapt to many kinds of systems. +\`configure' configures cc-tool 0.18 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1378,13 +1380,12 @@ Program names: System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cc-tool 0.13:";; + short | recursive ) echo "Configuration of cc-tool 0.18:";; esac cat <<\_ACEOF @@ -1434,7 +1435,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to the package provider. +Report bugs to . _ACEOF ac_status=$? fi @@ -1497,7 +1498,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cc-tool configure 0.13 +cc-tool configure 0.18 generated by GNU Autoconf 2.66 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1963,6 +1964,10 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ---------------------------------- ## +## Report this to george-u@yandex.com ## +## ---------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 @@ -1983,7 +1988,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cc-tool $as_me 0.13, which was +It was created by cc-tool $as_me 0.18, which was generated by GNU Autoconf 2.66. Invocation command line was $ $0 $@ @@ -2332,6 +2337,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +# AC_CANONICAL_SYSTEM +am__api_version='1.11' + ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -2361,119 +2369,6 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if test "${ac_cv_target+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - -am__api_version='1.11' - # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -2909,8 +2804,8 @@ fi # Define the identity of the package. - PACKAGE='cc-tool' - VERSION='0.13' + PACKAGE=cc-tool + VERSION=0.18 cat >>confdefs.h <<_ACEOF @@ -2976,6 +2871,77 @@ macro_revision='1.3175' ltmain="$ac_aux_dir/ltmain.sh" +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' @@ -15573,7 +15539,319 @@ fi -#BOOST_THREADS([mt]) +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the flags needed to use pthreads" >&5 +$as_echo_n "checking for the flags needed to use pthreads... " >&6; } +if test "${boost_cv_pthread_flag+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + boost_cv_pthread_flag= + # The ordering *is* (sometimes) important. Some notes on the + # individual items follow: + # (none): in case threads are in libc; should be tried before -Kthread and + # other compiler flags to prevent continual compiler warnings + # -lpthreads: AIX (must check this before -lpthread) + # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads) + # -pthreads: Solaris/GCC + # -mthreads: MinGW32/GCC, Lynx/GCC + # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it + # doesn't hurt to check since this sometimes defines pthreads too; + # also defines -D_REENTRANT) + # ... -mt is also the pthreads flag for HP/aCC + # -lpthread: GNU Linux, etc. + # --thread-safe: KAI C++ + case $host_os in #( + *solaris*) + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #( + *) + boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \ + -pthreads -mthreads -lpthread --thread-safe -mt";; + esac + # Generate the test file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); + ; + return 0; +} +_ACEOF + for boost_pthread_flag in '' $boost_pthread_flags; do + boost_pthread_ok=false + boost_pthreads__save_LIBS=$LIBS + LIBS="$LIBS $boost_pthread_flag" + if ac_fn_cxx_try_link "$LINENO"; then : + if grep ".*$boost_pthread_flag" conftest.err; then + echo "This flag seems to have triggered warnings" >&5 + else + boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + LIBS=$boost_pthreads__save_LIBS + $boost_pthread_ok && break + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $boost_cv_pthread_flag" >&5 +$as_echo "$boost_cv_pthread_flag" >&6; } +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +boost_threads_save_LIBS=$LIBS +boost_threads_save_CPPFLAGS=$CPPFLAGS +LIBS="$LIBS $boost_cv_pthread_flag" +# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3, +# boost/thread.hpp will trigger a #error if -pthread isn't used: +# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support +# is not turned on. Please set the correct command line options for +# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" +CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag" +if test x"$boost_cv_inc_path" = xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Boost not available, not searching for the Boost thread library" >&5 +$as_echo "$as_me: Boost not available, not searching for the Boost thread library" >&6;} +else +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test x"$boost_cv_inc_path" = xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Boost not available, not searching for boost/thread.hpp" >&5 +$as_echo "$as_me: Boost not available, not searching for boost/thread.hpp" >&6;} +else +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +boost_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +ac_fn_cxx_check_header_mongrel "$LINENO" "boost/thread.hpp" "ac_cv_header_boost_thread_hpp" "$ac_includes_default" +if test "x$ac_cv_header_boost_thread_hpp" = x""yes; then : + +$as_echo "#define HAVE_BOOST_THREAD_HPP 1" >>confdefs.h + +else + as_fn_error $? "cannot find boost/thread.hpp" "$LINENO" 5 +fi + + +CPPFLAGS=$boost_save_CPPFLAGS +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +fi + +boost_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +# Now let's try to find the library. The algorithm is as follows: first look +# for a given library name according to the user's PREFERRED-RT-OPT. For each +# library name, we prefer to use the ones that carry the tag (toolset name). +# Each library is searched through the various standard paths were Boost is +# usually installed. If we can't find the standard variants, we try to +# enforce -mt (for instance on MacOSX, libboost_threads.dylib doesn't exist +# but there's -obviously- libboost_threads-mt.dylib). +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the Boost thread library" >&5 +$as_echo_n "checking for the Boost thread library... " >&6; } +if test "${boost_cv_lib_thread+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + boost_cv_lib_thread=no + case "mt" in #( + mt | mt-) boost_mt=-mt; boost_rtopt=;; #( + mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "Xmt" : 'Xmt-*\(.*\)'`;; #( + *) boost_mt=; boost_rtopt=mt;; + esac + if test $enable_static_boost = yes; then + boost_rtopt="s$boost_rtopt" + fi + # Find the proper debug variant depending on what we've been asked to find. + case $boost_rtopt in #( + *d*) boost_rt_d=$boost_rtopt;; #( + *[sgpn]*) # Insert the `d' at the right place (in between `sg' and `pn') + boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #( + *) boost_rt_d='-d';; + esac + # If the PREFERRED-RT-OPT are not empty, prepend a `-'. + test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt" + $boost_guess_use_mt && boost_mt=-mt + # Look for the abs path the static archive. + # $libext is computed by Libtool but let's make sure it's non empty. + test -z "$libext" && + as_fn_error $? "the libext variable is empty, did you invoke Libtool?" "$LINENO" 5 + boost_save_ac_objext=$ac_objext + # Generate the test file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +boost::thread t; boost::mutex m; + ; + return 0; +} +_ACEOF + if ac_fn_cxx_try_compile "$LINENO"; then : + ac_objext=do_not_rm_me_plz +else + as_fn_error $? "cannot compile a test that uses Boost thread" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext + ac_objext=$boost_save_ac_objext + boost_failed_libs= +# Don't bother to ident the 6 nested for loops, only the 2 innermost ones +# matter. +for boost_tag_ in -$boost_cv_lib_tag ''; do +for boost_ver_ in -$boost_cv_lib_version ''; do +for boost_mt_ in $boost_mt -mt ''; do +for boost_rtopt_ in $boost_rtopt '' -d; do + for boost_lib in \ + boost_thread$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \ + boost_thread$boost_tag_$boost_rtopt_$boost_ver_ \ + boost_thread$boost_tag_$boost_mt_$boost_ver_ \ + boost_thread$boost_tag_$boost_ver_ + do + # Avoid testing twice the same lib + case $boost_failed_libs in #( + *@$boost_lib@*) continue;; + esac + # If with_boost is empty, we'll search in /lib first, which is not quite + # right so instead we'll try to a location based on where the headers are. + boost_tmp_lib=$with_boost + test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include} + for boost_ldpath in "$boost_tmp_lib/lib" '' \ + /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \ + "$with_boost" C:/Boost/lib /lib* + do + test -e "$boost_ldpath" || continue + boost_save_LDFLAGS=$LDFLAGS + # Are we looking for a static library? + case $boost_ldpath:$boost_rtopt_ in #( + *?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt) + boost_cv_lib_thread_LIBS="$boost_ldpath/lib$boost_lib.$libext" + test -e "$boost_cv_lib_thread_LIBS" || continue;; #( + *) # No: use -lboost_foo to find the shared library. + boost_cv_lib_thread_LIBS="-l$boost_lib";; + esac + boost_save_LIBS=$LIBS + LIBS="$boost_cv_lib_thread_LIBS $LIBS" + test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath" + rm -f conftest$ac_exeext +boost_save_ac_ext=$ac_ext +boost_use_source=: +# If we already have a .o, re-use it. We change $ac_ext so that $ac_link +# tries to link the existing object file instead of compiling from source. +test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false && + $as_echo "$as_me:${as_lineno-$LINENO}: re-using the existing conftest.$ac_objext" >&5 +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_executable_p conftest$ac_exeext + }; then : + boost_cv_lib_thread=yes +else + if $boost_use_source; then + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi + boost_cv_lib_thread=no +fi +ac_objext=$boost_save_ac_objext +ac_ext=$boost_save_ac_ext +rm -f core conftest.err conftest_ipa8_conftest.oo \ + conftest$ac_exeext + ac_objext=$boost_save_ac_objext + LDFLAGS=$boost_save_LDFLAGS + LIBS=$boost_save_LIBS + if test x"$boost_cv_lib_thread" = xyes; then + boost_cv_lib_thread_LDFLAGS="-L$boost_ldpath -Wl,-R$boost_ldpath" + boost_cv_lib_thread_LDPATH="$boost_ldpath" + break 6 + else + boost_failed_libs="$boost_failed_libs@$boost_lib@" + fi + done + done +done +done +done +done +rm -f conftest.$ac_objext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $boost_cv_lib_thread" >&5 +$as_echo "$boost_cv_lib_thread" >&6; } +case $boost_cv_lib_thread in #( + no) $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + as_fn_error $? "cannot find the flags to link with Boost thread" "$LINENO" 5 + ;; +esac +BOOST_THREAD_LDFLAGS=$boost_cv_lib_thread_LDFLAGS +BOOST_THREAD_LDPATH=$boost_cv_lib_thread_LDPATH +BOOST_LDPATH=$boost_cv_lib_thread_LDPATH +BOOST_THREAD_LIBS=$boost_cv_lib_thread_LIBS +CPPFLAGS=$boost_save_CPPFLAGS +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +fi + +BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $boost_cv_pthread_flag" +BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag" +LIBS=$boost_threads_save_LIBS +CPPFLAGS=$boost_threads_save_CPPFLAGS + + @@ -16385,7 +16663,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cc-tool $as_me 0.13, which was +This file was extended by cc-tool $as_me 0.18, which was generated by GNU Autoconf 2.66. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16436,13 +16714,13 @@ $config_files Configuration commands: $config_commands -Report bugs to the package provider." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -cc-tool config.status 0.13 +cc-tool config.status 0.18 configured by $0, generated by GNU Autoconf 2.66, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index ef4f5a4..215ed68 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(cc-tool, 0.16, george-u@yandex.com) +AC_INIT(cc-tool, 0.18, george-u@yandex.com) # AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(cc-tool, 0.16) +AM_INIT_AUTOMAKE(cc-tool, 0.18) AC_PROG_LIBTOOL AC_PROG_CXX diff --git a/man/cc-tool.1 b/man/cc-tool.1 new file mode 100644 index 0000000..5591070 --- /dev/null +++ b/man/cc-tool.1 @@ -0,0 +1,136 @@ +.\" Process this file with +.\" groff -man -Tascii foo.1 +.\" +. +.TH cc-tool 1 "June 06 2012" "cc-tool 0.18" "USER COMMANDS" +. +.SH NAME +cc-tool \- control Texas Instruments CC Debugger +. +.SH SYNOPSIS +.B cc-tool +[options] +. +.SH DESCRIPTION +.B cc-tool +provides support of Texas Instruments CC Debugger and several evaluation boards in order to program TI 8051-based System-On-Chip devices +. +.SH SUPPORTED DEVICES +.B CC Debugger +(VID: 0x0451 PID: 0x16a2) +.br +.B SmartRF04 Evaluation Board +(VID: 0x11a0 PID: 0xdb20) +.br +.B SmartRF05 Evaluation Board +(VID: 0x0451 PID: 0x16a0) +. +.SH SUPPORTED TARGETS +CC2540 CC2530 CC2531 CC2533 CC2430 CC2431 CC2510 CC2511 CC1110 CC1111 +. +.SH OPTIONS +.TP +.B \-h, \-\-help +print help message +. +.TP +.B \-d, \-\-device bus_number:device_number +set programmer device usb address. +The option should be used only if several CC Debugger devices connected to the system simultaneously. +(you can use lsusb utility to enumerate devices connected to the system) +. +.TP +.B \-f, \-\-fast +set fast debug interface speed (by default: slow) +. +.TP +.B \-i, \-\-read-info-page [file_name] +read target info page (if target supports any). If no file-name specified data will be send to standard output. +. +.TP +.B \-a, \-\-read-mac-address +read target's mac address(es) (if target supports any). +. +.TP +.B \-r, \-\-read file_name +read flash memory and save to the specified file +. +.TP +.B \-e, \-\-erase +erase flash memory completely and reset lock bits +. +.TP +.B \-w, \-\-write file_name[,offset] +write specified file into flash memory. Optional offset value (in decimal) is an absolute target flash +address and supported only for binary files. Option +.I --write +may be specified several times to build composite flash image from several hex and/or binary files, +apply binary patches etc. Files will be merged in the order they appear in the command line. +. +.TP +.B \-v, \-\-verify [method] +verify flash after writing. Method can be +.I crc +(default) or +.I read. +Method +.I read +means that after writing all modified flash content is read back and compared to input flash image. +Method +.I crc +means that after writing is completed target is configured to calculate +CRC-16 over own flash and send results back so it ca be compared to crc of the input flash image. +Method crc is much faster against read out all flash data. +. +.TP +.B \-t, \-\-test +search for programmer and target and print various information of them. +. +.TP +.B \-l, \-\-lock lock_data +specify lock data in hex numbers. Lock data size must be exactly 1 byte (2 hex digits) or 16 bytes (32 hex digits) depending on target. +For several targets lock data can be placed into flash image file either +.TP +.B \-\-log [log_file] +create log file with all operations performed. Useful for debugging cc-tool itself. +Warning: if write operations is performed log file will also contain the written image! +. +.TP +.B \-\-reset +perform target reset. There's no need to use this option along with others because reset is performed anyway when needed +. +.TP +.B \-n, \-\-name target_name +specify target name e.g. CC2530 etc. If specified target does not match +detected one no further actions are performed. This option is not required. +. +.SH SUPPORTED FILE FORMATS +Supported image file formats are Intel hex or binary. Format will be determined automatically by file extention (hex or bin) +or my be specified explicitly by adding +.I ,bin +or +.I ,hex +after file name. See EXAMPLES section. +. +.SH EXAMPLES +.TP +Read entire flash into binary file image.xxx +.B cc_tool +-r image.xxx,bin +.TP +Erase flash, write intel hex file image.hex and verify flash using default method +.B cc_tool +-v -e -w image.hex +.TP +Merge file image.hex and patch.bin (at offset 80), write resulting image, verify flash using read method +.B cc_tool +-v read -w image.hex --write patch.bin,80 +. +.SH EXIT STATUS +.B cc-tool +returns a zero exist status if all action were performed successfully. +Non zero is returned in case of failure. +. +.SH AUTHOR +George Stark (george-u (at) yandex.com) +. diff --git a/src/application/cc_base.cpp b/src/application/cc_base.cpp index a6bcf6d..6678c2f 100644 --- a/src/application/cc_base.cpp +++ b/src/application/cc_base.cpp @@ -66,15 +66,12 @@ static void print_usage(const po::options_description &desc) //============================================================================== void CC_Base::init_options(po::options_description &desc) { - desc.add_options() - ("load", po::value >(), "load firmware image "); - desc.add_options() ("help,h", "produce help message"); desc.add_options() ("log", po::value(&option_log_name_)->implicit_value(""), - "create in the current directory log of all operations"); + "create log of all operations"); desc.add_options() ("device,d", po::value(&option_device_address_), @@ -201,14 +198,10 @@ bool CC_Base::execute(int argc, char *argv[]) po::options_description desc; init_options(desc); - po::positional_options_description pd; - pd.add("input-file", 1); - try { po::variables_map vm; - po::parsed_options parsed = po::command_line_parser(argc, argv).options(desc).allow_unregistered().positional(pd).run(); - po::store(parsed, vm); + po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if (vm.count("log")) @@ -223,6 +216,7 @@ bool CC_Base::execute(int argc, char *argv[]) process_tasks(); log_info("main, finish task processing"); programmer_.unit_close(); + return true; } } catch (std::runtime_error& e) // usb, file error diff --git a/src/application/cc_flasher.cpp b/src/application/cc_flasher.cpp index 9ec4cf0..4f40714 100644 --- a/src/application/cc_flasher.cpp +++ b/src/application/cc_flasher.cpp @@ -156,7 +156,7 @@ void CC_Flasher::init_options(po::options_description &desc) desc.add_options() ("write,w", po::value(), - "write flash memory. Option can be specified several times."); + "write flash memory."); desc.add_options() ("verify,v", po::value(&option_verify_type_)->implicit_value(""), @@ -326,8 +326,8 @@ void CC_Flasher::task_read_mac_address() if (unit_info_.mac_address_count == 1) { - std::cout << " MAC address: " << binary_to_hex(&mac0[0], mac0.size(), ":") - << "\n"; + std::cout << " MAC address: " + << binary_to_hex(&mac0[0], mac0.size(), ":") << "\n"; } else { diff --git a/src/main.cpp b/src/main.cpp index acf816c..de4a239 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,7 +14,6 @@ int main(int argc, char **argv) { CC_Flasher cc_flasher; - cc_flasher.execute(argc, argv); - return 0; + return cc_flasher.execute(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/src/programmer/cc_243x.cpp b/src/programmer/cc_243x.cpp index abd8f4a..503ac68 100644 --- a/src/programmer/cc_243x.cpp +++ b/src/programmer/cc_243x.cpp @@ -59,7 +59,7 @@ void CC_243x::find_unit_info(UnitInfo &unit_info) unit_info.flags = UnitInfo::SUPPORT_MAC_ADDRESS; unit_info.lock_size = 1; unit_info.max_flash_size = 128; - unit_info.flash_page_size = 2048; + unit_info.flash_page_size = 2; unit_info.mac_address_count = 1; ByteVector sfr; diff --git a/src/programmer/cc_251x_111x.cpp b/src/programmer/cc_251x_111x.cpp index 4597cfc..fac66cd 100644 --- a/src/programmer/cc_251x_111x.cpp +++ b/src/programmer/cc_251x_111x.cpp @@ -11,6 +11,9 @@ #include "cc_251x_111x.h" #include "cc_debug_interface.h" +const uint16_t XDATA_RAM_OFFSET = 0xF000; +const uint16_t XDATA_SFR_OFFSET = 0xDF00; + //============================================================================== CC_251x_111x::CC_251x_111x(USB_Device &programmer, ProgressWatcher &pw) : CC_UnitDriver(programmer, pw) @@ -21,8 +24,9 @@ CC_251x_111x::CC_251x_111x(USB_Device &programmer, ProgressWatcher &pw) : reg_info.verify_block_size = 512; reg_info.write_block_size = 512; reg_info.xbank_offset = 0; - reg_info.dma0_cfg_offset = 0xFF00; - reg_info.dma_data_offset = 0xF000; + + reg_info.dma0_cfg_offset = XDATA_RAM_OFFSET + 0x0F00; + reg_info.dma_data_offset = XDATA_RAM_OFFSET + 0x0000; reg_info.rndh = 0xDFBD; reg_info.rndl = 0xDFBC; @@ -46,8 +50,8 @@ void CC_251x_111x::supported_units(Unit_ID_List &units) { units.push_back(Unit_ID(0x2510, "CC2510")); units.push_back(Unit_ID(0x2511, "CC2511")); - units.push_back(Unit_ID(0x1111, "CC1110")); - units.push_back(Unit_ID(0x1110, "CC1111")); + units.push_back(Unit_ID(0x1111, "CC1111")); + units.push_back(Unit_ID(0x1110, "CC1110")); } //============================================================================== @@ -55,8 +59,9 @@ void CC_251x_111x::find_unit_info(UnitInfo &unit_info) { unit_info.lock_size = 1; unit_info.max_flash_size = 32; - unit_info.flash_page_size = 1024; + unit_info.flash_page_size = 1; unit_info.mac_address_count = 1; + unit_info.flags = UnitInfo::SUPPORT_INFO_PAGE; ByteVector sfr; diff --git a/src/programmer/cc_unit_driver.cpp b/src/programmer/cc_unit_driver.cpp index 653e019..b3aa537 100644 --- a/src/programmer/cc_unit_driver.cpp +++ b/src/programmer/cc_unit_driver.cpp @@ -510,7 +510,7 @@ void CC_UnitDriver::write_flash_slow(const DataSectionStore §ion_store) ByteVector data; section_store.create_image(0xFF, data); - data.resize((section_store.upper_address() + (WRITE_BLOCK_SIZE- 1)) & + data.resize((section_store.upper_address() + (WRITE_BLOCK_SIZE - 1)) & ~(WRITE_BLOCK_SIZE - 1), 0xFF); pw_.write_start(data.size()); diff --git a/src/version.h b/src/version.h index e25a42a..2a3161b 100644 --- a/src/version.h +++ b/src/version.h @@ -1,10 +1,10 @@ /* - * File : version.h - * Last changed : $Date: 2011-12-13 01:50:21 +0400 (Tue, 13 Dec 2011) $ - * Revision : $Rev: 189 $ + * version.h * - * Author : George Stark - * License : GNU GPL v2 + * Created on: Jul 28, 2011 + * Author: George Stark + * + * License: GNU GPL v2 * */ @@ -14,7 +14,7 @@ #include "common.h" const uint_t VERSION_MAJOR = 0; -const uint_t VERSION_MINOR = 16; +const uint_t VERSION_MINOR = 18; const char MODULE_NAME[] = "cc-tool"; const char MODULE_DESCRIPTION[] = "Texas Instruments 8051-based System-On-Chip devices programmer using TI CC Debugger"; diff --git a/udev/90-cc-debugger.rules b/udev/90-cc-debugger.rules new file mode 100644 index 0000000..bdb73dc --- /dev/null +++ b/udev/90-cc-debugger.rules @@ -0,0 +1,9 @@ +# SmartRF05 Evaluation Board +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a0", MODE="0666" + +# SmartRF04 Evaluation Board +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="11a0", ATTRS{idProduct}=="db20", MODE="0666" + +# CC Debugger +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a2", MODE="0666" +