- convert spaces to tabs in at91sam7.[ch]
- add missing svn props git-svn-id: svn://svn.berlios.de/openocd/trunk@1009 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
c90c48b00b
commit
279affdb98
408
doc/INSTALL.txt
408
doc/INSTALL.txt
|
@ -1,204 +1,204 @@
|
|||
TODO!!! this should be merged into openocd.texi!!!
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
When building with support for FTDI FT2232 based devices, you need at least
|
||||
one of the following libraries:
|
||||
|
||||
- libftdi (http://www.intra2net.com/opensource/ftdi/)
|
||||
- libftd2xx (http://www.ftdichip.com/Drivers/D2XX.htm)
|
||||
|
||||
On Windows, you need either Cygwin or MinGW, but compilation for MinGW is also
|
||||
possible using a Cygwin host.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
OpenOCD is distributed without autotools generated files, i.e. without a
|
||||
configure script. Run ./bootstrap in the openocd directory to have all
|
||||
necessary files generated.
|
||||
|
||||
You have to explicitly enable desired JTAG interfaces during configure:
|
||||
|
||||
./configure --enable-parport --enable-ft2232-libftdi (OR --enable-ft2232-ftd2xx) \
|
||||
--enable-amtjtagaccel
|
||||
|
||||
Under Windows/Cygwin, only the ftd2xx driver is supported for FT2232 based
|
||||
devices. You have to specify the location of the FTDI driver package with the
|
||||
--with-ftd2xx=/full/path/name option.
|
||||
|
||||
Under Linux you can choose to build the parport driver with support for
|
||||
/dev/parportN instead of the default access with direct port I/O using
|
||||
--enable-parport_ppdev. This has the advantage of running OpenOCD without root
|
||||
privileges at the expense of a slight performance decrease. This is also
|
||||
available on FreeBSD using PPI, but the naming of the devices is different.
|
||||
|
||||
Generic installation instructions
|
||||
=================================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes a while. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
4. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
||||
TODO!!! this should be merged into openocd.texi!!!
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
When building with support for FTDI FT2232 based devices, you need at least
|
||||
one of the following libraries:
|
||||
|
||||
- libftdi (http://www.intra2net.com/opensource/ftdi/)
|
||||
- libftd2xx (http://www.ftdichip.com/Drivers/D2XX.htm)
|
||||
|
||||
On Windows, you need either Cygwin or MinGW, but compilation for MinGW is also
|
||||
possible using a Cygwin host.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
OpenOCD is distributed without autotools generated files, i.e. without a
|
||||
configure script. Run ./bootstrap in the openocd directory to have all
|
||||
necessary files generated.
|
||||
|
||||
You have to explicitly enable desired JTAG interfaces during configure:
|
||||
|
||||
./configure --enable-parport --enable-ft2232-libftdi (OR --enable-ft2232-ftd2xx) \
|
||||
--enable-amtjtagaccel
|
||||
|
||||
Under Windows/Cygwin, only the ftd2xx driver is supported for FT2232 based
|
||||
devices. You have to specify the location of the FTDI driver package with the
|
||||
--with-ftd2xx=/full/path/name option.
|
||||
|
||||
Under Linux you can choose to build the parport driver with support for
|
||||
/dev/parportN instead of the default access with direct port I/O using
|
||||
--enable-parport_ppdev. This has the advantage of running OpenOCD without root
|
||||
privileges at the expense of a slight performance decrease. This is also
|
||||
available on FreeBSD using PPI, but the naming of the devices is different.
|
||||
|
||||
Generic installation instructions
|
||||
=================================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes a while. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
4. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
||||
|
|
4810
src/ecosboard.c
4810
src/ecosboard.c
File diff suppressed because it is too large
Load Diff
1772
src/flash/at91sam7.c
1772
src/flash/at91sam7.c
File diff suppressed because it is too large
Load Diff
|
@ -26,95 +26,94 @@
|
|||
#include "flash.h"
|
||||
#include "target.h"
|
||||
|
||||
|
||||
typedef struct at91sam7_flash_bank_s
|
||||
{
|
||||
/* chip id register */
|
||||
u32 cidr;
|
||||
u16 cidr_ext;
|
||||
u16 cidr_nvptyp;
|
||||
u16 cidr_arch;
|
||||
u16 cidr_sramsiz;
|
||||
u16 cidr_nvpsiz;
|
||||
u16 cidr_nvpsiz2;
|
||||
u16 cidr_eproc;
|
||||
u16 cidr_version;
|
||||
char *target_name;
|
||||
/* chip id register */
|
||||
u32 cidr;
|
||||
u16 cidr_ext;
|
||||
u16 cidr_nvptyp;
|
||||
u16 cidr_arch;
|
||||
u16 cidr_sramsiz;
|
||||
u16 cidr_nvpsiz;
|
||||
u16 cidr_nvpsiz2;
|
||||
u16 cidr_eproc;
|
||||
u16 cidr_version;
|
||||
char *target_name;
|
||||
|
||||
/* flash auto-detection */
|
||||
u8 flash_autodetection;
|
||||
/* flash auto-detection */
|
||||
u8 flash_autodetection;
|
||||
|
||||
/* flash geometry */
|
||||
u16 pages_per_sector;
|
||||
u16 pagesize;
|
||||
u16 pages_in_lockregion;
|
||||
/* flash geometry */
|
||||
u16 pages_per_sector;
|
||||
u16 pagesize;
|
||||
u16 pages_in_lockregion;
|
||||
|
||||
/* nv memory bits */
|
||||
u16 num_lockbits_on;
|
||||
u16 lockbits;
|
||||
u16 num_nvmbits;
|
||||
u16 num_nvmbits_on;
|
||||
u16 nvmbits;
|
||||
u8 securitybit;
|
||||
/* nv memory bits */
|
||||
u16 num_lockbits_on;
|
||||
u16 lockbits;
|
||||
u16 num_nvmbits;
|
||||
u16 num_nvmbits_on;
|
||||
u16 nvmbits;
|
||||
u8 securitybit;
|
||||
|
||||
/* 0: not init
|
||||
1: fmcn for nvbits (1uS)
|
||||
2: fmcn for flash (1.5uS) */
|
||||
u8 flashmode;
|
||||
/* 0: not init
|
||||
* 1: fmcn for nvbits (1uS)
|
||||
* 2: fmcn for flash (1.5uS) */
|
||||
u8 flashmode;
|
||||
|
||||
/* main clock status */
|
||||
u8 mck_valid;
|
||||
u32 mck_freq;
|
||||
/* main clock status */
|
||||
u8 mck_valid;
|
||||
u32 mck_freq;
|
||||
|
||||
/* external clock frequency */
|
||||
u32 ext_freq;
|
||||
/* external clock frequency */
|
||||
u32 ext_freq;
|
||||
|
||||
} at91sam7_flash_bank_t;
|
||||
|
||||
|
||||
/* AT91SAM7 control registers */
|
||||
#define DBGU_CIDR 0xFFFFF240
|
||||
#define CKGR_MCFR 0xFFFFFC24
|
||||
#define CKGR_MOR 0xFFFFFC20
|
||||
#define CKGR_MCFR_MAINRDY 0x10000
|
||||
#define CKGR_PLLR 0xFFFFFC2c
|
||||
#define CKGR_PLLR_DIV 0xff
|
||||
#define CKGR_PLLR_MUL 0x07ff0000
|
||||
#define PMC_MCKR 0xFFFFFC30
|
||||
#define PMC_MCKR_CSS 0x03
|
||||
#define PMC_MCKR_PRES 0x1c
|
||||
#define DBGU_CIDR 0xFFFFF240
|
||||
#define CKGR_MCFR 0xFFFFFC24
|
||||
#define CKGR_MOR 0xFFFFFC20
|
||||
#define CKGR_MCFR_MAINRDY 0x10000
|
||||
#define CKGR_PLLR 0xFFFFFC2c
|
||||
#define CKGR_PLLR_DIV 0xff
|
||||
#define CKGR_PLLR_MUL 0x07ff0000
|
||||
#define PMC_MCKR 0xFFFFFC30
|
||||
#define PMC_MCKR_CSS 0x03
|
||||
#define PMC_MCKR_PRES 0x1c
|
||||
|
||||
/* Flash Controller Commands */
|
||||
#define WP 0x01
|
||||
#define SLB 0x02
|
||||
#define WPL 0x03
|
||||
#define CLB 0x04
|
||||
#define EA 0x08
|
||||
#define SGPB 0x0B
|
||||
#define CGPB 0x0D
|
||||
#define SSB 0x0F
|
||||
#define WP 0x01
|
||||
#define SLB 0x02
|
||||
#define WPL 0x03
|
||||
#define CLB 0x04
|
||||
#define EA 0x08
|
||||
#define SGPB 0x0B
|
||||
#define CGPB 0x0D
|
||||
#define SSB 0x0F
|
||||
|
||||
/* MC_FSR bit definitions */
|
||||
#define MC_FSR_FRDY 1
|
||||
#define MC_FSR_EOL 2
|
||||
#define MC_FSR_FRDY 1
|
||||
#define MC_FSR_EOL 2
|
||||
|
||||
/* AT91SAM7 constants */
|
||||
#define RC_FREQ 32000
|
||||
#define RC_FREQ 32000
|
||||
|
||||
/* Flash timing modes */
|
||||
#define FMR_TIMING_NONE 0
|
||||
#define FMR_TIMING_NVBITS 1
|
||||
#define FMR_TIMING_FLASH 2
|
||||
#define FMR_TIMING_NONE 0
|
||||
#define FMR_TIMING_NVBITS 1
|
||||
#define FMR_TIMING_FLASH 2
|
||||
|
||||
/* Flash size constants */
|
||||
#define FLASH_SIZE_8KB 1
|
||||
#define FLASH_SIZE_16KB 2
|
||||
#define FLASH_SIZE_32KB 3
|
||||
#define FLASH_SIZE_64KB 5
|
||||
#define FLASH_SIZE_128KB 7
|
||||
#define FLASH_SIZE_256KB 9
|
||||
#define FLASH_SIZE_512KB 10
|
||||
#define FLASH_SIZE_1024KB 12
|
||||
#define FLASH_SIZE_2048KB 14
|
||||
#define FLASH_SIZE_8KB 1
|
||||
#define FLASH_SIZE_16KB 2
|
||||
#define FLASH_SIZE_32KB 3
|
||||
#define FLASH_SIZE_64KB 5
|
||||
#define FLASH_SIZE_128KB 7
|
||||
#define FLASH_SIZE_256KB 9
|
||||
#define FLASH_SIZE_512KB 10
|
||||
#define FLASH_SIZE_1024KB 12
|
||||
#define FLASH_SIZE_2048KB 14
|
||||
|
||||
#endif /* AT91SAM7_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,98 +1,98 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2006 by Magnus Lundin *
|
||||
* lundin@mlu.mine.nu *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef AT91SAM7_OLD_H
|
||||
#define AT91SAM7_OLD_H
|
||||
|
||||
#include "flash.h"
|
||||
#include "target.h"
|
||||
|
||||
typedef struct at91sam7_old_flash_bank_s
|
||||
{
|
||||
u32 working_area;
|
||||
u32 working_area_size;
|
||||
|
||||
/* chip id register */
|
||||
u32 cidr;
|
||||
u16 cidr_ext;
|
||||
u16 cidr_nvptyp;
|
||||
u16 cidr_arch;
|
||||
u16 cidr_sramsiz;
|
||||
u16 cidr_nvpsiz;
|
||||
u16 cidr_nvpsiz2;
|
||||
u16 cidr_eproc;
|
||||
u16 cidr_version;
|
||||
char * target_name;
|
||||
|
||||
/* flash geometry */
|
||||
u16 num_pages;
|
||||
u16 pagesize;
|
||||
u16 pages_in_lockregion;
|
||||
u8 num_erase_regions;
|
||||
u8 num_planes;
|
||||
u32 *erase_region_info;
|
||||
|
||||
/* nv memory bits */
|
||||
u16 num_lockbits;
|
||||
u16 lockbits[4];
|
||||
u16 num_nvmbits;
|
||||
u16 nvmbits;
|
||||
u8 securitybit;
|
||||
u8 flashmode[4]; /* 0: not init, 1: fmcn for nvbits (1uS), 2: fmcn for flash (1.5uS) */
|
||||
|
||||
/* main clock status */
|
||||
u8 mck_valid;
|
||||
u32 mck_freq;
|
||||
|
||||
} at91sam7_old_flash_bank_t;
|
||||
|
||||
/* AT91SAM7 control registers */
|
||||
#define DBGU_CIDR_old 0xFFFFF240
|
||||
#define CKGR_MCFR_old 0xFFFFFC24
|
||||
#define CKGR_MCFR_MAINRDY_old 0x10000
|
||||
#define CKGR_PLLR_old 0xFFFFFC2c
|
||||
#define CKGR_PLLR_DIV_old 0xff
|
||||
#define CKGR_PLLR_MUL_old 0x07ff0000
|
||||
#define PMC_MCKR_old 0xFFFFFC30
|
||||
#define PMC_MCKR_CSS_old 0x03
|
||||
#define PMC_MCKR_PRES_old 0x1c
|
||||
|
||||
/* Flash Controller Commands */
|
||||
#define WP_old 0x01
|
||||
#define SLB_old 0x02
|
||||
#define WPL_old 0x03
|
||||
#define CLB_old 0x04
|
||||
#define EA_old 0x08
|
||||
#define SGPB_old 0x0B
|
||||
#define CGPB_old 0x0D
|
||||
#define SSB_old 0x0F
|
||||
|
||||
/* MC_FSR bit definitions */
|
||||
#define MC_FSR_FRDY_old 1
|
||||
#define MC_FSR_EOL_old 2
|
||||
|
||||
/* AT91SAM7 constants */
|
||||
#define RC_FREQ_old 32000
|
||||
|
||||
/* FLASH_TIMING_MODES */
|
||||
#define FMR_TIMING_NONE_old 0
|
||||
#define FMR_TIMING_NVBITS_old 1
|
||||
#define FMR_TIMING_FLASH_old 2
|
||||
|
||||
#endif /* AT91SAM7_OLD_H */
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by Magnus Lundin *
|
||||
* lundin@mlu.mine.nu *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef AT91SAM7_OLD_H
|
||||
#define AT91SAM7_OLD_H
|
||||
|
||||
#include "flash.h"
|
||||
#include "target.h"
|
||||
|
||||
typedef struct at91sam7_old_flash_bank_s
|
||||
{
|
||||
u32 working_area;
|
||||
u32 working_area_size;
|
||||
|
||||
/* chip id register */
|
||||
u32 cidr;
|
||||
u16 cidr_ext;
|
||||
u16 cidr_nvptyp;
|
||||
u16 cidr_arch;
|
||||
u16 cidr_sramsiz;
|
||||
u16 cidr_nvpsiz;
|
||||
u16 cidr_nvpsiz2;
|
||||
u16 cidr_eproc;
|
||||
u16 cidr_version;
|
||||
char * target_name;
|
||||
|
||||
/* flash geometry */
|
||||
u16 num_pages;
|
||||
u16 pagesize;
|
||||
u16 pages_in_lockregion;
|
||||
u8 num_erase_regions;
|
||||
u8 num_planes;
|
||||
u32 *erase_region_info;
|
||||
|
||||
/* nv memory bits */
|
||||
u16 num_lockbits;
|
||||
u16 lockbits[4];
|
||||
u16 num_nvmbits;
|
||||
u16 nvmbits;
|
||||
u8 securitybit;
|
||||
u8 flashmode[4]; /* 0: not init, 1: fmcn for nvbits (1uS), 2: fmcn for flash (1.5uS) */
|
||||
|
||||
/* main clock status */
|
||||
u8 mck_valid;
|
||||
u32 mck_freq;
|
||||
|
||||
} at91sam7_old_flash_bank_t;
|
||||
|
||||
/* AT91SAM7 control registers */
|
||||
#define DBGU_CIDR_old 0xFFFFF240
|
||||
#define CKGR_MCFR_old 0xFFFFFC24
|
||||
#define CKGR_MCFR_MAINRDY_old 0x10000
|
||||
#define CKGR_PLLR_old 0xFFFFFC2c
|
||||
#define CKGR_PLLR_DIV_old 0xff
|
||||
#define CKGR_PLLR_MUL_old 0x07ff0000
|
||||
#define PMC_MCKR_old 0xFFFFFC30
|
||||
#define PMC_MCKR_CSS_old 0x03
|
||||
#define PMC_MCKR_PRES_old 0x1c
|
||||
|
||||
/* Flash Controller Commands */
|
||||
#define WP_old 0x01
|
||||
#define SLB_old 0x02
|
||||
#define WPL_old 0x03
|
||||
#define CLB_old 0x04
|
||||
#define EA_old 0x08
|
||||
#define SGPB_old 0x0B
|
||||
#define CGPB_old 0x0D
|
||||
#define SSB_old 0x0F
|
||||
|
||||
/* MC_FSR bit definitions */
|
||||
#define MC_FSR_FRDY_old 1
|
||||
#define MC_FSR_EOL_old 2
|
||||
|
||||
/* AT91SAM7 constants */
|
||||
#define RC_FREQ_old 32000
|
||||
|
||||
/* FLASH_TIMING_MODES */
|
||||
#define FMR_TIMING_NONE_old 0
|
||||
#define FMR_TIMING_NVBITS_old 1
|
||||
#define FMR_TIMING_FLASH_old 2
|
||||
|
||||
#endif /* AT91SAM7_OLD_H */
|
||||
|
|
|
@ -80,25 +80,23 @@ extern flash_driver_t lpc288x_flash;
|
|||
extern flash_driver_t ocl_flash;
|
||||
|
||||
flash_driver_t *flash_drivers[] = {
|
||||
&lpc2000_flash,
|
||||
&cfi_flash,
|
||||
&at91sam7_flash,
|
||||
&at91sam7_old_flash,
|
||||
&str7x_flash,
|
||||
&str9x_flash,
|
||||
&aduc702x_flash,
|
||||
&stellaris_flash,
|
||||
&str9xpec_flash,
|
||||
&stm32x_flash,
|
||||
&tms470_flash,
|
||||
&ecosflash_flash,
|
||||
&lpc288x_flash,
|
||||
&ocl_flash,
|
||||
NULL,
|
||||
&lpc2000_flash,
|
||||
&cfi_flash,
|
||||
&at91sam7_flash,
|
||||
&at91sam7_old_flash,
|
||||
&str7x_flash,
|
||||
&str9x_flash,
|
||||
&aduc702x_flash,
|
||||
&stellaris_flash,
|
||||
&str9xpec_flash,
|
||||
&stm32x_flash,
|
||||
&tms470_flash,
|
||||
&ecosflash_flash,
|
||||
&lpc288x_flash,
|
||||
&ocl_flash,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
|
||||
flash_bank_t *flash_banks;
|
||||
static command_t *flash_cmd;
|
||||
|
||||
|
|
|
@ -92,13 +92,13 @@ extern flash_bank_t *get_flash_bank_by_num(int num);
|
|||
extern flash_bank_t *get_flash_bank_by_num_noprobe(int num);
|
||||
extern flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr);
|
||||
|
||||
#define ERROR_FLASH_BANK_INVALID (-900)
|
||||
#define ERROR_FLASH_SECTOR_INVALID (-901)
|
||||
#define ERROR_FLASH_OPERATION_FAILED (-902)
|
||||
#define ERROR_FLASH_DST_OUT_OF_BANK (-903)
|
||||
#define ERROR_FLASH_DST_BREAKS_ALIGNMENT (-904)
|
||||
#define ERROR_FLASH_BUSY (-905)
|
||||
#define ERROR_FLASH_SECTOR_NOT_ERASED (-906)
|
||||
#define ERROR_FLASH_BANK_NOT_PROBED (-907)
|
||||
#define ERROR_FLASH_BANK_INVALID (-900)
|
||||
#define ERROR_FLASH_SECTOR_INVALID (-901)
|
||||
#define ERROR_FLASH_OPERATION_FAILED (-902)
|
||||
#define ERROR_FLASH_DST_OUT_OF_BANK (-903)
|
||||
#define ERROR_FLASH_DST_BREAKS_ALIGNMENT (-904)
|
||||
#define ERROR_FLASH_BUSY (-905)
|
||||
#define ERROR_FLASH_SECTOR_NOT_ERASED (-906)
|
||||
#define ERROR_FLASH_BANK_NOT_PROBED (-907)
|
||||
|
||||
#endif /* FLASH_H */
|
||||
|
|
1478
src/jtag/zy1000.c
1478
src/jtag/zy1000.c
File diff suppressed because it is too large
Load Diff
|
@ -106,14 +106,14 @@ int cortex_m3_clear_halt(target_t *target)
|
|||
armv7m_common_t *armv7m = target->arch_info;
|
||||
cortex_m3_common_t *cortex_m3 = armv7m->arch_info;
|
||||
swjdp_common_t *swjdp = &cortex_m3->swjdp_info;
|
||||
|
||||
/* Read Debug Fault Status Register */
|
||||
ahbap_read_system_atomic_u32(swjdp, NVIC_DFSR, &cortex_m3->nvic_dfsr);
|
||||
/* Write Debug Fault Status Register to enable processing to resume ?? Try with and without this !! */
|
||||
ahbap_write_system_atomic_u32(swjdp, NVIC_DFSR, cortex_m3->nvic_dfsr);
|
||||
LOG_DEBUG(" NVIC_DFSR 0x%x", cortex_m3->nvic_dfsr);
|
||||
|
||||
/* Read Debug Fault Status Register */
|
||||
ahbap_read_system_atomic_u32(swjdp, NVIC_DFSR, &cortex_m3->nvic_dfsr);
|
||||
/* Write Debug Fault Status Register to enable processing to resume ?? Try with and without this !! */
|
||||
ahbap_write_system_atomic_u32(swjdp, NVIC_DFSR, cortex_m3->nvic_dfsr);
|
||||
LOG_DEBUG(" NVIC_DFSR 0x%x", cortex_m3->nvic_dfsr);
|
||||
|
||||
return ERROR_OK;
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int cortex_m3_single_step_core(target_t *target)
|
||||
|
@ -287,8 +287,8 @@ int cortex_m3_examine_exception_reason(target_t *target)
|
|||
break;
|
||||
}
|
||||
swjdp_transaction_endcheck(swjdp);
|
||||
LOG_DEBUG("%s SHCSR 0x%x, SR 0x%x, CFSR 0x%x, AR 0x%x", armv7m_exception_string(armv7m->exception_number), \
|
||||
shcsr, except_sr, cfsr, except_ar);
|
||||
LOG_DEBUG("%s SHCSR 0x%x, SR 0x%x, CFSR 0x%x, AR 0x%x", armv7m_exception_string(armv7m->exception_number), \
|
||||
shcsr, except_sr, cfsr, except_ar);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -363,9 +363,9 @@ int cortex_m3_debug_entry(target_t *target)
|
|||
}
|
||||
|
||||
LOG_DEBUG("entered debug state in core mode: %s at PC 0x%x, target->state: %s",
|
||||
armv7m_mode_strings[armv7m->core_mode],
|
||||
*(u32*)(armv7m->core_cache->reg_list[15].value),
|
||||
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name);
|
||||
armv7m_mode_strings[armv7m->core_mode],
|
||||
*(u32*)(armv7m->core_cache->reg_list[15].value),
|
||||
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name);
|
||||
|
||||
if (armv7m->post_debug_entry)
|
||||
armv7m->post_debug_entry(target);
|
||||
|
@ -439,7 +439,7 @@ int cortex_m3_poll(target_t *target)
|
|||
*/
|
||||
|
||||
#if 0
|
||||
/* Read Debug Fault Status Register, added to figure out the lockup when running flashtest.script */
|
||||
/* Read Debug Fault Status Register, added to figure out the lockup when running flashtest.script */
|
||||
ahbap_read_system_atomic_u32(swjdp, NVIC_DFSR, &cortex_m3->nvic_dfsr);
|
||||
LOG_DEBUG("dcb_dhcsr 0x%x, nvic_dfsr 0x%x, target->state: %s", cortex_m3->dcb_dhcsr, cortex_m3->nvic_dfsr, Jim_Nvp_value2name( nvp_target_state, target->state )->name );
|
||||
#endif
|
||||
|
@ -455,7 +455,7 @@ int cortex_m3_halt(target_t *target)
|
|||
swjdp_common_t *swjdp = &cortex_m3->swjdp_info;
|
||||
|
||||
LOG_DEBUG("target->state: %s",
|
||||
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
|
||||
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
|
||||
|
||||
if (target->state == TARGET_HALTED)
|
||||
{
|
||||
|
@ -518,7 +518,7 @@ int cortex_m3_soft_reset_halt(struct target_s *target)
|
|||
retval = ahbap_read_system_atomic_u32(swjdp, DCB_DHCSR, &dcb_dhcsr);
|
||||
if (retval == ERROR_OK)
|
||||
{
|
||||
ahbap_read_system_atomic_u32(swjdp, NVIC_DFSR, &cortex_m3->nvic_dfsr);
|
||||
ahbap_read_system_atomic_u32(swjdp, NVIC_DFSR, &cortex_m3->nvic_dfsr);
|
||||
if ((dcb_dhcsr & S_HALT) && (cortex_m3->nvic_dfsr & DFSR_VCATCH))
|
||||
{
|
||||
LOG_DEBUG("system reset-halted, dcb_dhcsr 0x%x, nvic_dfsr 0x%x", dcb_dhcsr, cortex_m3->nvic_dfsr);
|
||||
|
@ -563,11 +563,9 @@ int cortex_m3_resume(struct target_s *target, int current, u32 address, int hand
|
|||
if (debug_execution)
|
||||
{
|
||||
/* Disable interrupts */
|
||||
/*
|
||||
We disable interrupts in the PRIMASK register instead of masking with C_MASKINTS,
|
||||
This is probably the same inssue as Cortex-M3 Errata 377493:
|
||||
C_MASKINTS in parallel with disabled interrupts can cause local faults to not be taken.
|
||||
*/
|
||||
/* We disable interrupts in the PRIMASK register instead of masking with C_MASKINTS,
|
||||
* This is probably the same inssue as Cortex-M3 Errata 377493:
|
||||
* C_MASKINTS in parallel with disabled interrupts can cause local faults to not be taken. */
|
||||
buf_set_u32(armv7m->core_cache->reg_list[ARMV7M_PRIMASK].value, 0, 32, 1);
|
||||
/* Make sure we are in Thumb mode */
|
||||
buf_set_u32(armv7m->core_cache->reg_list[ARMV7M_xPSR].value, 0, 32,
|
||||
|
@ -654,7 +652,7 @@ int cortex_m3_step(struct target_s *target, int current, u32 address, int handle
|
|||
armv7m_restore_context(target);
|
||||
|
||||
target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
|
||||
|
||||
|
||||
if (cortex_m3->dcb_dhcsr & C_MASKINTS)
|
||||
ahbap_write_system_atomic_u32(swjdp, DCB_DHCSR, DBGKEY | C_HALT | C_DEBUGEN );
|
||||
ahbap_write_system_atomic_u32(swjdp, DCB_DHCSR, DBGKEY| C_STEP | C_DEBUGEN);
|
||||
|
@ -683,7 +681,7 @@ int cortex_m3_assert_reset(target_t *target)
|
|||
int assert_srst = 1;
|
||||
|
||||
LOG_DEBUG("target->state: %s",
|
||||
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
|
||||
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
|
||||
|
||||
if (!(jtag_reset_config & RESET_HAS_SRST))
|
||||
{
|
||||
|
@ -765,10 +763,10 @@ int cortex_m3_assert_reset(target_t *target)
|
|||
|
||||
{
|
||||
/* I do not know why this is necessary, but it fixes strange effects
|
||||
(step/resume cause a NMI after reset) on LM3S6918 -- Michael Schwingen */
|
||||
* (step/resume cause a NMI after reset) on LM3S6918 -- Michael Schwingen */
|
||||
u32 tmp;
|
||||
ahbap_read_system_atomic_u32(swjdp, NVIC_AIRCR, &tmp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
target->state = TARGET_RESET;
|
||||
|
@ -776,12 +774,12 @@ int cortex_m3_assert_reset(target_t *target)
|
|||
|
||||
armv7m_invalidate_core_regs(target);
|
||||
|
||||
if (target->reset_halt)
|
||||
{
|
||||
int retval;
|
||||
if (target->reset_halt)
|
||||
{
|
||||
int retval;
|
||||
if ((retval = target_halt(target))!=ERROR_OK)
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
@ -789,7 +787,7 @@ int cortex_m3_assert_reset(target_t *target)
|
|||
int cortex_m3_deassert_reset(target_t *target)
|
||||
{
|
||||
LOG_DEBUG("target->state: %s",
|
||||
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name);
|
||||
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name);
|
||||
|
||||
/* deassert reset lines */
|
||||
jtag_add_reset(0, 0);
|
||||
|
@ -826,7 +824,7 @@ int cortex_m3_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
|
|||
LOG_WARNING("breakpoint already set");
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
if (cortex_m3->auto_bp_type)
|
||||
{
|
||||
breakpoint->type = (breakpoint->address < 0x20000000) ? BKPT_HARD : BKPT_SOFT;
|
||||
|
|
Loading…
Reference in New Issue