Monday, January 31, 2011

Jan.29 hg cMake set-up

Q:\Carolyn\hg4\forte\2010\forte1103WS\FORTE   last good autoconf workspace

Get forte source
  •  First check-out from hg 
    • http://fordiac.hg.sourceforge.net/hgweb/fordiac/forte/
Put forte source under eclipse
  • create WS directory
  • Import into Eclipse the hg clone directory as an existing project 
    • Check copy source into eclipse project (optional)
Copy built ecos under eclipse
  • create directories bin/lms and copy the ecos include and lib directories into it.
  • create bin/lms/src directory


Generate Makefiles using Cmake
  • Install cMake
  • Open cMake Gui 
  • For source directory enter the Eclipse project directory.
  • For build directory, enter the top level binary directory (usually pathto/bin)
  • Configure
    • Press configure button
    • From the dropdown for: Specify the generator for this project
      • Choose: UNIX Makefiles
    • For cross compiler use first 
      • choose toolchain  with UNIX makefiles and press configure

      • Operation System: eCos
      • Compilers for C:     arm-elf-gcc 
        • and for C++:  arm-elf-g++
          • Need to include path if not installed under cygwin
      • path to target  
        • Usually same as path to build binaries
        • This has to be changed when ever workspace / file location changes
    • then
      • clear cache (will not clear the toolchain default)
      • choose options and press configure.
    • enter the text file with the options like below and press configure
INCLUDE(CMakeForceCompiler)

# this one is important
SET(CMAKE_SYSTEM_NAME eCos)

# specify the cross compiler
CMAKE_FORCE_C_COMPILER(arm-elf-gcc GNU)
CMAKE_FORCE_CXX_COMPILER(arm-elf-g++ GNU)

# where is the target environment 
SET(CMAKE_FIND_ROOT_PATH  C:/Users/Carolyn/Desktop/DistCntl/lms/forte012811WS/FORTE/bin/lms)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)




    • Chose options wanted and press configure
      • Check LMS - (A system must be checked.)
      • Check FBDK, but uncheck IP
      • Check FBs needed (none in example)
      • Uncheck all 3 real data types (not available in LMS)
    • Press generate
    • In Eclipse make all
      • (Note: under cygwin in lms/bin dir - make forte also works)
    • Generate forte.bin separately or as part of flashing bat file
      • arm-elf-objcopy --gap-fill 0xFF -O binary forte.elf forte.bin
        • Notice now .elf  before no extension
    • Ready to flash and test on LMS






Friday, November 26, 2010

Nov.26,27 Dev Env reinstall

My Laptop's network adaptors stopped working. The reason is not clear - virus/trojan or deleting the files for a Virtual Machine manually - but get to do an install of development environment on a clean system. So...


updated Nov.18+26 Tutorial Dev Environment Summary with new information learned like:
  • Installing gnuarm added cygwin location correctly to the windows registry
  • c:\local\bin; had to be added manually to the window path for the eclipse compile to work correctly
  • Testing arm-elf-insight caused the firewall to ask for certain features to be blocked/unblocked.
    • Not blocking solved a previous problem where the gdb GUI did not work.
  • Added links for serial download. Wondering how this .bat file and source should be packaged for the tutorial.
  • At one point from make all in eclipse got the error ld error message "uses hardware FP, whereas forte uses software FP". Still not sure what combination caused this error message.
  • Installed gnuarm 4.1, cygwin 1.7, java 1.6.0_22  in C:\local, because wrongly thought there was a problem, C:\Program Files, has a blank in the name. Some older notes said Forte does not work with blank in file name. Still good having the tools in one place, since hope to create a zip with tools needed.


Thursday, November 18, 2010

Nov.18+26 Tutorial Dev Environment Summary

Links for setting up tools needed: 
  • Java SE6
  • Build Environment 
    • cygwin
    • add cygwin/bin location to the path 
    • installing gnuarm set the window registry entry needed for cygwin 1.7 for use with eclipse
  • Eclipse with C-Development Tools (CDT)
  • FORTE
  • 4DIAC-IDE 
Other
  • loop-back device 
    • install check: Device Manager => Network Adaptors => MS Loopback Device
    • needed for virtual network on 1 PC with 4diac/forte
Cross-compiling and debugging for ARM
  • GNUARM includes arm-elf-insight for debugging
    • used: binutils-2.17, gcc-4.1.1-c-c++, newlib-1.14.0, insight-6.5, setup.exe
    • install check: 
      • 1. echo $PATH Your install directory for /gnuarm/bin should be in the path.
      • 2. in a cygwin command window enter arm-elf-insight. The GNU GDB RedHat Source Window should appear.
        • arm-elf-insight GUI will not work if blocked by firewall
    • Cross-compiling in eclipse
      • use arm-elf-g++
    • Debugging with GNU GDB arm-elf-insight forte 
      • open a cygwin command window
      • cd to the directory with the forte executable
        • ex: cd /cygdrive/h/lms/bin/src/forte
      • enter arm-elf-insight forte
      • GUI Source Window opens
        • Run > Connect to Target: (for Segger JLINK)
          • Target: Remote TCP
          • Hostname: localhost
          • Port: 3333
        • View > Console
          • monitor reset
          • monitor halt
        • View > set breakpoints
          • max of 2 breakpoints for lms
          • max of 1 breakpoint when stepping through code
Flashing the LMS
    eCos, Samba, usb Drivers are needed for the following:

Nov.17 OpenOCD install tries

1. The drivers sometimes revert back to the first driver installed:
see previous Nov. blog entries for driver details
  • Ports(COM&LPT) ecosUsbSerial to libwin32usb/ecos usb driver
    • need a COM port for forte deployment FB download
  • Universial Serial usb controllers/atmel driver reverts to Lego device/firmware update mode
    • need  atmel driver to flash via sam-ba
2. openocd on my laptop
The correct way to install will be documented in a separate blog entry.
Try1: Just copy directory and usb.dll needed to my laptop. Not enough.
Try2: Find out what first praktikat used.
Found link to install .msi file that is no longer actual, but google found: 
Search in this website for OpenOCD Windows installer lead to a current list of installers 

Question:
What is a FTDI type chip which needs libusb?
libftdi is a library that talks to FTDI's FT232/245BM, FT2232C/D, and FT232/245R type chips, including the popular bitbang mode
Answer: See OpenOCD user's guide... FTDI type chip is used in some JTAG doggles, but not in the Segger JLINK.
If understand right then libusb doesn't have to be installed.
However for the Raven it is needed.

So it is not possible to use the version the first praktikat used.
openocd  -v says Alex used 0.3.0-in-development version.
A website with a list of openocd Windows installers says 0.3.1 has important fixes
so...
Try3: install openocd 0.3.1 using an .msi installer found online
Installed with no problem from zip.
All files needed are in the zip.

Wednesday, November 17, 2010

Nov. 17 Line Follower Algorithms / Beginners

Each week I meet with 2 friends, so they can learn about Lego Robot one of them recently bought.
Today we accidently found a simple algorithm that looks for the line and then follows it.
The line follower allows lots of algorithms.  First two friends downloaded, tried and looked at existing NXT-G programs. In the end they could somewhat follow the program, but could not make even minor changes successfully to the program. 
Today we started with basics. Motors block; Loop testing light sensor or looping forever;  If-then-else branch block.

[Picture of algorithm goes here]
The idea was:
Step 1: Go when see white, stop when see black. 
Loop while see white
Then stop
Step 2: Loop forever
If-then-else branch for light sensor:
IF white
THEN: forwards
ELSE: turn x degrees

We found when it found the line when x was around 45 degrees, the robot would follow the edge of the  line if it was on the correct edge for the direction it should go in. Since blue was seen as black, it lost the line at the blue box.

The Video shows the attempts starting with 90 degrees, then 45 degrees, then 25 degrees.

[VIDEO(S) COMING]

Monday, November 15, 2010

Nov.15 OpenOCD Flashing on AA PC

TODO
Get a version with export 4.0 working with FBs!
SEGWAY


1a. OpenOCD  is part of the gnuarm toolchain. 
OpenOCD does not have offical releases, but some stable releases are available. It was easiest to copy the OpenOCD in the on Alex's PC to my laptop and add it to the path. Unfortantely its not clear where this working version came from orginally.

1b.Support for mulitple versions of forte.bin at once.
Created a flash_forte_bin directory to copy forte.bin and forte to for use with openocd bat files.
New bat file:  cp_Oflash.bat
Now
C:\openocd\trunk3\testing\examples\SAM7S256Test\prj\sam7s256_flash_Q.cfg file is also hard coded to this directory.

2. CBC/Scheme

- plug in keyboard and display
--  result: CBC booted the same.
    It didn't seem to be aware of the keyboard or display automatically.
- kernel # for ubuntu10.4 is at least 2.6.32.9
-- if kernel is new enough the CBC Linux driver is included
--- (11/17 note: interesting the driver link is same those doggles needing usblib)
- Can't use CBCJVM - Racket has its on Racket machine bytecode

Botball has another language forum. Only Java seems to be doing anything.

Friday, November 12, 2010

Nov.13 How to update driver

1. Right click on the device and choose Update Driver
2. Again choose Update Driver and OK
3. Choose Browse my computer for driver software


4. Enter the directory with the .inf and .sys driver files
5. If driver is installed chose the second option and a list of installed drivers for the device will show-up.  Then you are ready to test in SAM-BA.