M8C utilities (Open Source, Linux)

A catchall for PSoC Mixed-Signal Array (microcontroller) discussions not captured by the other forums.

Moderator: ericb

M8C utilities (Open Source, Linux)

Postby werner on Wed Mar 01, 2006 10:17 am

The M8C utilities now have a regular home on SourceForge:

http://m8cutils.sourceforge.net/

This is a collection of development utilities for M8C cores in general,
and PSoC(tm) uCs in particular. They're written for Linux, but may also
run on other platforms. They include a programmer (with schematics and
PCB layouts for, at the moment, two types of programmer hardware), a
very simple assembler, an even simpler disassembler, and a simulator in
the making. The simulator also features DIY ICE access.

All this is still heavily under construction.

I've also released a new version:

http://m8cutils.sourceforge.net/m8cutils-8.tar.gz
md5sum 90959d468278fd15bca487bb576f7358
sha1sum 0fbac3e4134053c97fb6faa929e67478bafca63c

This one fixes more horrible simulator bugs. It also makes the simulator
use readline to read from a terminal, which makes interactive use so
much nicer. I've included a description of a very simple blinking LEDs
example in sim/example/.

Besides that, I've cleaned up the build process some more. The utilities
should now be installed (make install) for use. The default install locations
are /usr/bin and /usr/share/m8cutils/. You can change this by editing the
INSTALL_PREFIX line in Common.make.

For older release notes and such, please see this thread in the "Device
Programmers" forum:
http://www.psocdeveloper.com/forums/viewtopic.php?t=1685

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

build problems, simulator fixes and improvements

Postby werner on Thu Mar 02, 2006 6:33 am

New and improved:

http://m8cutils.sourceforge.net/m8cutils-9.tar.gz
md5sum c363d0375cc4c19c5f4387258b512fec
sha1sum 3bd92d8fb35de6bf53257e9348496f3c8522fe3c

Yet another round of simulator bug fixes (all of them nasty, of course).
Then I've fixed a number of build problems that could occur on very old
(Red Hat 9) or very new (gcc 4.1) systems.

In terms of new features, the simulator is getting increasingly better at
behaving like a debugger. It can now be interrupted and one can
single-step through programs. There are still no real breakpoints and
the like, though.

For a quick overview of what the simulator can already do and how to
use the rest of the package, you may want to have a look at
sim/example/README.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Tue Mar 07, 2006 2:42 pm

Cleanup and lots of programmer improvements:

http://m8cutils.sourceforge.net/m8cutils-10.tar.gz
md5sum 1fdbc81a1408fb17aa92680d58a2f73a
sha1sum 8cd468ff89e5e723b8e67686ea710f58fc81944e

This release cleans up the organization of include files, solves a few
minor build problems, has the usual set of simulator fixes, and brings
a number of programmer improvements:

- operations that are under a deadline, such as sending parts of
Initialize-1, are now timed, and m8cprog will abort if it misses the
deadline

- new option -R to use real-time priority, to increase the odds of
meeting deadlines

- new experimental option -s to retrieve the protection bits, and to use
them to help the other operations. This is joint work with Dennis Geurts.

For the future, I'm thinking of moving the programmer hardware bits to
a separate package, since they're quite big and don't change that often.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Tue Jun 06, 2006 7:23 pm

Back from hibernation:

http://m8cutils.sourceforge.net/m8cutils-11.tar.gz
md5sum 682136a3645e2234d05e0902b7eed3ae
sha1sum bf8d5819ac7042474788caba8a159413cde5ff1c

This release fixes a major bug in the assembler: operations
involving symbols could change the value of the symbol.
I guess my brain cell wasn't watching when I did this ...

There's also a new programmer, this time for the parallel
port. It's similar to CYP-Type3 by Ajith S., but the power
handling is different. I still need to implement support for
power

Besides that, there's some more minor cleanup, as
usual.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Wed Jun 07, 2006 1:44 pm

I wrote:I still need to implement support for power

... power-on mode (in m8cprog).

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Thu Jun 08, 2006 8:44 pm

Missing files, new programmer driver, lots of simulator
improvements:

http://m8cutils.sourceforge.net/m8cutils-12.tar.gz
md5sum 0afb4e5a551385078d54ffbe8d3b7d49
sha1sum d2e8bf3ab1ef5521b8880b1151dcc772b6c3af7b

First of all, the files prog/cli.h and prog/cli.c were missing
in m8cutils-11. Sorry about that. They're included in this
release.

There is now the first contributed driver for programmer
hardware: ecb_at91 by Carlos Camargo.

Then, GPIO handling in the simulator has gotten more
powerful: ports can now be set directly with commands
like "set p0[3:2] = 2r" (set p0[2] to resistive 1, p0[3] to
resistive 0), so it's no longer necessary to fiddle with
individual DR and DMx bits. In order to keep the syntax
consistent, a simulated drive now has to be prefixed
with "drive", e.g., "drive p0[0] = 0".

Port status is still shown by just specifying the port or
port with bit range, e.g., "p0", but it now displays also
DR, DMx, and the ICE setting, not only the simulated
drive.

Invocation of the simulator is now a bit more flexible,
so one doesn't have to specify a program if none is
needed (e.g., if the simulator is only used for driving
a circuit through the ICE). Similarly, the chip name
can be omitted if using the ICE.

Earlier versions didn't generate GPIO interrupts after
changing DR, DM0, or DM1. This is now fixed.

Last but not least, the simulation script can now interface
with the user, though the commands "printf" and "sleep".
They are particularly useful in machine-generated test
scripts.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Mon Jun 12, 2006 8:16 pm

Housekeeping and direct ICE register access:

http://m8cutils.sourceforge.net/m8cutils-13.tar.gz
md5sum 4c07dda875cdc45444a68f6a44686835
sha1sum 6c81b5eb2701c585a237a2b946a70f6a65126d8b

Starting with this release, the programmer hardware has
moved to a separate package, called m8cprogs.
I'll open a thread for it over in the device programmers
forum. The host software for programming, m8cprog,
remains in m8cutils.

I've also changed the directory structure a little: m8cutils
now extract in a directory m8cutils-version, which is
more consistent with what packages normally do.

In order to have at least one new feature to report, I've
added direct access to target registers through the ICE
in the simulator. By prefixing a read or write access with
the keyword "ice", the register in the target is accessed.

Note that this completely bypasses the internal state of
the simulator, so one can cause quite some confusion with
it. The main purpose of this extension is to help the
development of simulator code that properly integrates
the subsystems in question, but it's also useful for
general experiments.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Thu Jun 22, 2006 6:44 pm

Register definitions, symbols, and DIY ICE improvements:

http://m8cutils.sourceforge.net/m8cutils-14.tar.gz
md5sum 7d21bcc8e2fa04190e3d0e6721d113e3
sha1sum a01710c11acce50aff59131125c7caa51f3cf617

This is another "push out all the changes" release.

This release has a lot more register definitions. This is
still far from complete, but most of the two column limited
system is there. (This is mainly for the assembler. m8csim
also sees the definitions, but still lacks the models to
emulate anything but GPIO. One can use all registers for
direct ICE accesses, though.)

m8cas can now produce a human-readable symbol map,
which can then be used by m8cdas and m8csim to make
things look a little prettier.

When m8csim stops, it now displays the instruction at the
current PC. Combined with the use of symbols,
single-stepping through code is now beginning to be
useful.

Last but not least, I found out that accessing a register
through ISSP stops SYSCLK, which can make debugging
quite interesting :-) So, m8csim now executes some code
to restart SYSCLK immediately after any ICE access.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Wed Jul 05, 2006 11:59 am

First support for power-on mode, and assembler and simulator
improvements:

http://m8cutils.sourceforge.net/m8cutils-15.tar.gz
md5sum 6e150d9603b2cf5cc32f9bd9327ff245
sha1sum 9615ff7a68d8db1e6e4741b96f9a1bf39faf8584

I've now finally implemented power-on mode in m8cprog.
At the moment, the only driver that supports this is watpp.
To enable power-on mode, use the new option -P and
don't forget to specify the voltage (-5).

Note: for stable operation, I recommend adding a 4k7
resistor between VDD and GND in the watpp circuit.
Otherwise, the target may retain power in its capacitors,
and thus fail to reset, which will may yield undefined
behaviour, or errors like this one:
"power-on timed out while waiting for SDATA"

The 4k7 resistor will be good for up to 10uF.

In the simulator, expressions can now be used almost
everwhere where previously only numbers were allowed.
Symbols (labels) that conflict with a keyword of the
scripting language can now be protected by putting them
into double quotes.

Last but not least, the assembler can now process more
than one file per run. Such files share only their global
scope, not the local scope, i.e., this is similar to separate
assembly followed by a linker run.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Wed Aug 02, 2006 6:27 am

Paging bug fix, CY8C24423A chip ID, more register definitions,
and breakpoints:

http://m8cutils.sourceforge.net/m8cutils-16.tar.gz
md5sum 70d959a25e7a900fe5f5913f392a73a5
sha1sum 29d6c67030b00dda973d3c0efa225da2e05015c2

This release fixes a simulator bug that causes writes to page
registers to be ignored. Another correction is in the chips
database, which now contains the correct code for the CY8C24423A.

I've started working towards having the complete set of register
definitions. They're still not capability-based, i.e., you get the
full set no matter what chip you're using, but this will change in
the future. One result of the new material is the utility
misc/reginfo, which prints structure and (optionally) content of a
register, e.g., "reginfo DEC_CR0 0x50" would yield

Code: Select all
DEC_CR0: 0,E6h

    7         6         5         4         3         2         1         0
---------+---------+---------+---------+---------+---------+---------+---------
                 IGEN                  | ICLKS0  |       DCOL        | DCLKS0
---------+---------+---------+---------+---------+---------+---------+---------
    0    |    1    |    0    |    1    |    0    |    0    |    0    |    0
---------+---------+---------+---------+---------+---------+---------+---------
                 (0x5)                 |   0x0   |       ACol0       |   0x0
---------+---------+---------+---------+---------+---------+---------+---------


m8csim now has breakpoints. They're set with "break" or "break
ADDRESS" and removed with "unbreak", "unbreak ADDRESS" or
"unbreak *". Use "run" to continue from a breakpoint.
sim/README has all the gory details.

And then there's the usual janitorial work, mainly in the Makefiles.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Wed Sep 06, 2006 10:16 pm

Programmer cleanup on exit and register definitions:

http://m8cutils.sourceforge.net/m8cutils-17.tar.gz
md5sum de3f41f6b487c71dccd971b121ca7e75
sha1sum d8b92f1fa911efc5ca9cb1cbc8b5f8666b3939bc

This release brings a few changes which are likely to affect
any current use.

First, m8cprog now tries to halt the target at the end, either
by leaving it unpowered, holding it in reset, or just not
letting it exit ISSP mode. In the past, usually only the latter
happened, so if you're testing circuits while attached to the
programmer, you probably have to change your reset
procedure (see below).

There is a new option -D, which, as far as the programmer
hardware supports all this, resets the target at the end and
tri-states SCLK and SDATA. This is currently only supported
by the watpp driver.

The other big change is to the register definitions. They should
now be complete, and there can now be chip-specific variants.
As a consequence, the chip being used has to be defined
before including m8c.h or m8c.inc.

Example:
Code: Select all
#define CY8C24423A
#include "m8c.inc"


Multiple chips can be defined, as long as there is no conflict in
the structure of their registers. (E.g., you can't have DEC_CR0
for chips with the limited and chips with the unlimited analog
system at the same time, because the size of IGEN differs.)

Further details can be found in regs/README.

The register definitions add quite a bit of new material, and
there are also various open issues regarding the naming
(see http://www.psocdeveloper.com/forums/viewtopic.php?t=2376),
so expect bugs and future changes.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Mon Oct 09, 2006 12:48 pm

Bug fix time:

http://m8cutils.sourceforge.net/m8cutils-18.tar.gz
md5sum dc8da1359448b6e382d742c651aff6ba
sha1sum 24c6b773af53304a339063ca64c8251e55659db0

This is a janitorial release, cleaning up several build problems
after the rearranging of things in the previous release, and
fixing a few bugs that have been around for a good while,
among them m8cas producing incorrect Intel HEX files :-(

Sorry that this took so long - been busy with other projects.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Mon Oct 30, 2006 2:04 am

Various programmer enhancements:

http://m8cutils.sourceforge.net/m8cutils-19.tar.gz
md5sum 763728cc3af75918c3512490618c553a
sha1sum b407a190fab9c0e648109af37ef0a821d8dc7a57

This release adds support for generating and handling the protection
bits: m8cas now reads a flashsecurity.txt file (a different file can be
chosen with "-f filename") and puts the resulting data into the Intel
HEX file. m8cprog can use this information, a file specified with -f,
or global protections specified with "-F mode" (e.g., "-F W").

There were also a number of bugs in the handling of security data
all over the place. They should be fixed now.

Then, the protocol stack in m8cprog is now more clearly layered. A
driver can provide functions at any layer, and the stack will supply
translation functions for any higher-level operations missing. All
this is fairly new, so I may still rearrange some things.

The layers are "bit" (bit-banging operations), "vector" (22 bit vectors),
"prim" (the ISSP primitives from AN2026), and "ops" (highest-level
operations). The "prim" layer should be convenient for "intelligent"
programmers.

One such programmer is "dummy", which emulates a programmer and
target combination in memory. In addition to this, it can read/write
its "Flash" to/from a disk file. It's used for the regression tests of
m8cprog (yes, finally there are some !).

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Tue Dec 05, 2006 5:50 am

There's quite a lot of changes this time. There are programmer fixes
and improvements, better portability, and cool new assembler features:

http://m8cutils.sourceforge.net/m8cutils-20.tar.gz
md5sum 1ca14d7da09f8b1e1f28ffa6d052df32
sha1sum 7a23895defeb78db3831fb6163e4f174fefbe97f

This release contains a number of fixes and improvements for m8cprog and
its surroundings, among them faster operation by printing less data for
the progress bar (yes, this makes a difference) and by skipping blocks
that are all-zeroes. Then, SDATA is now sampled after SCLK has dropped,
making bit-banging programmers more tolerant to slow SDATA response from
the target. There is also support for a new serial bit-banging programmer
called "wadsp", which is part of the current release of m8cprogs.

"torture" now works again, now also offers a throughput measurement mode,
can close and re-open sessions (to exercise target acquisition), and
recovers better from errors.

Mike Moreton has contributed various portability improvements, which
allow m8cutils (without m8cprog) also to be built with Cygwin under
Windows.

Finally, m8cas now has an ASSERT directive, GNU assembler-style
redefinable local labels (e.g., .10: inc x jnz .10b), and the cumulative
clock cycle count in @. With this, one can write routines that don't poll
if a certain event with known latency (e.g., transmission of a byte) has
happened, and let the assembler check that the timing is indeed valid.
See as/tests/cyles for a short example.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Mon Dec 18, 2006 6:00 am

Boundary scan and preprocessor directives for m8cas:

http://m8cutils.sourceforge.net/m8cutils-21.tar.gz
md5sum 358ca0dcbcae343f729e5b8fb85d4141
sha1sum be655616e9a5a7101fdbcef3c1529eb47c4dba75

This release has just two new features, but both are quite sizeable:

There's a new tools to perform boundary scans, called m8cbscan. It takes
a description of how the various pins of the PSoC are supposed to behave,
and then generates and performs a series of tests to check whether the
circuit really does what is expected. Communication with the target is
through ISSP, so any programmer suported by m8cutils can be used. For
more details, see bscan/README and bscan/example/README.

The second new feature is that m8cas finally supports all the
preprocessor directives, i.e., IF...ELSE...ENDIF, macros, and INCLUDE.
With earlier versions of m8cas one has to use CPP for this (which is of
course still possible). The new directives improve compatibility with
the Cypress tools, and they also make it possible to use the value of
labels in conditions, e.g., to decide whether the insertion of NOPs is
needed for padding or to reach a minimum cycle count.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Sat Dec 30, 2006 9:09 pm

Housekeeping:

http://m8cutils.sourceforge.net/m8cutils-22.tar.gz
md5sum 78f0e89dddcb259ef135886b9c455c20
sha1sum 9ed796b938e8eebdcd645c579f080dc0829ba06a

A janitorial release cleaning up re-definable labels: their semantics are now
more clearly defined, and EQU is explicitly an exception. I.e., you can update
a re-definable label like this:
Code: Select all
.0:     equ     .0b+1

This also worked before for backward-references, but not for forward-references.
Similarly, re-usable labels are now removed after an EQU, so the value of a
re-usable labels can be assigned to a local or global label, i.e.
Code: Select all
.foo:   ...
bar:    equ     .foo


Then, m8cdas and m8csim now also know about the "b" and "f" for re-definable
labels. Finally, recursive definitions of labels are now caught and don't cause
an infinite recursion in m8cas.

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby werner on Tue Jan 02, 2007 5:06 am

Happy new year ! This is the time when people look back on what has happened in
their lives in the last twelve months, and make plans for that they'd like to
count among their achievements in their annual review due the next year, with
varying likeliness that this will come to pass, of course. So let me do the
same.

About a year ago, I started the m8cutils project, with the goal to produce a
basic set of Open Source development tools for PSoCs. Since this is a hobby
project (my home turf is software, but I got interested in microcontrollers a
couple of years ago, and eventually stumbled upon the PSoCs, with their
intriguingly flexible architecture, but, to my great dismay, a deeply
proprietary development environment), I've focused mainly on features I had
some immediate use for, but also on functionality not fully exploited by
Cypress' own tools, such as the DIY ICE and the boundary scan connection
checker.

The core utilities, i.e., the programmer, the assembler, and the disassembler
now look pretty good, and probably won't need major changes anytime soon. The
simulator is still only barely useful, and will need considerably more work
before its potential is fully realized. The boundary scanner is brand-new and I
still need more practical experience with it to determine which direction its
development shall take.

I think that the user base is still pretty small, probably less than ten people
in total. This means that I don't get much feedback about bugs and other
problems, which in turn slows down QA. On the other hand, I feel less guilty if
I need to make drastic, incompatible changes.

So, what will the future bring ?

As I've mentioned in this forum before, I'd like to have a decent Open Source C
compiler for the M8C. While I've actually started working on that, I've had far
less time for it than I would have hoped, so there isn't anything worth showing
yet. Since my last "daytime" project has come to an end, I should have a bit
more time to play with the compiler for a while.

One of my goals is to focus on using modern compiler technology, which means
that a fair amount of infrastructure code will be needed before the compiler
will be able to do anything useful (and I still have some literature research
to do), but then, it should be possible to reap benefits at a steady pace. At
least that's how I hope it will happen :-) Things should be clearer in a couple
of months.

Another tool I want to make is a router and resource allocator, of course with
code generation. That would be similar to the resource allocation done with
User Modules, but in a more general way, also allowing things like pin
assignments to be part of the search. I've already experimented a bit with this
idea and have even written a (flawed but useful for understanding the problem
better) prototype. The challenge will be the computational complexity of all
this. If it can be contained, that tool should be great. If not, well, there's
always a less ambitious plan B.

There are also a few smaller things, such as adding listing generation to
m8cas, a broader choice of programmers, including "intelligent" ones, and more
capabilities for m8csim. Also, given that most of the m8cutils code already
compiles under Windows, it would be nice if someone could contribute a port of
the I/O functions in libprog.

So, there is a lot to do. Time to get cracking :-)

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

m8cas Command line issues

Postby hollae on Fri Jan 26, 2007 6:32 am

I installed the m8cutills on my fedora 5 linux computer at home.

ran "make Install" in the main directory

and ran "make tests" in the main directory and everything passed.

My problem is I tried to run the m8cas assembler from command line and I cann't get it to work. I copied teh blink.asm file that is in the "sim" directory into the "as" directory and typed "m8cas -b blink.asm" on the command line and all I get is "m8cas not found" errors.

The m8cas executable is in the "as" folder, but I not having much luck. I'll be the first to admitt I'm not super proficent at Linux, so I guess it is something dumb I'm doing.

Any Ideas?

Thanks,
Eric
User avatar
hollae
Cheese Cube
Cheese Cube
 
Posts: 29
Joined: Wed Jan 10, 2007 6:18 am
Location: Mankato, MN USA

Re: m8cas Command line issues

Postby werner on Fri Jan 26, 2007 9:50 am

hollae wrote: typed "m8cas -b blink.asm" on the command line and all I get is "m8cas not found" errors.


Strange. After "make install", m8cas should be in /usr/bin, which is certainly in your
PATH. I suppose you didn't edit Config.make or pass INSTALL_PREFIX=something
to "make install", did you ? Did "make install" complete without errors ?

If the problem still persists, please send me the output of "make V=1 install" to
werner@almesberger.net

By the way, you have to invoke "m8cas" with the option -e to build blink.asm,
since it's using a CPP directive (#include).

- Werner
werner
The Big Cheese
The Big Cheese
 
Posts: 246
Joined: Fri Jan 20, 2006 10:20 am
Location: Buenos Aires, Argentina

Postby hollae on Fri Jan 26, 2007 12:06 pm

The only files I saw in the /usr/bin was the different *.inc files

I didn't intentionally mess with the INSTALL_PREFIX=

I'll try reinstalling it and check the "make install" for errors

I'll also try moving the m8cas executable to the /usr/bin folder and seeing if that helps.

Thanks, I'll try a few things and post my results.
User avatar
hollae
Cheese Cube
Cheese Cube
 
Posts: 29
Joined: Wed Jan 10, 2007 6:18 am
Location: Mankato, MN USA

Next

Return to PSoC1 General

Who is online

Users browsing this forum: No registered users and 3 guests

cron