On 2010-12-03 21:39, Rolf Meeser wrote:
On 12/03/2010 08:09 PM, Freddie Chopin wrote:
First of all, the chip frequency after reset actually is 4MHz due to
internal RC oscillator, so this "default frequency" assumption seems
pretty correct (actually it was probably me who added that script to
OpenOCD).
Incorrect. Yes, the chip starts from its 4 MHz oscillator, but what the
clock frequency actually is by the time OpenOCD gets access is
unpredictable.
If for instance the flash is empty, the device will enter ISP mode
automatically. It will activate the PLL, and from then on run with
14.748 MHz. When in this situation you program the flash with the clock
parameter set to 4 MHz, the programming pulse will have a width of less
than 30% of the required time. Might work, usually will, but is unreliable.
The clock parameter is vital for correct and reliable flash programming.
It must be possible for the user to select the frequency that he is using.
I don't know how about you, but me (and 99% of "normal users") "reset
halt" the chip before programming - so it does run at 4MHz during
programming.
Debugging is negligibly faster when using high clock, flash
programming duration gain is probably also negligible (what's the
difference between waiting for 20 seconds to waiting for 10 seconds?).
10 seconds? 100% (as seen by the the lucky 10s user)? And by the way
this is unrealistic. The penalty is much higher!
At 72 MHz I can program the LPC2478 (504 KiB) in 14s with a simple JTAG
interface. I feel no urge to wait longer than that.
And how often do you flash full 504kB? 100kB will take ~4s, so whats a
difference between ~4 and ~20 seconds? How about small program - 10kB?
In a day "your way" will give me maybe 1 free minute more. For me that's
not worth the trouble [; But that's not the main point...
Anyway - I never enable PLL before flash programming, I bet that most
"regular users" also don't.
A classical chicken and egg case. We don't have good board scripts
especially for the LPC devices. That's why people don't use it.
And you won't have because world does not end on "ready made boards".
That's why people don't use them and that's why IMHO there is no point
in creating them. What's the point for a board config file if most of
the boards with small microcontrollers don't have any external ram,
fancy reset circuitry and anything unusual - normal target file works
just fine, and what's most important for me (and not only me!) is that
it works standalone - without anything more.
But most of all - this makes running OpenOCD with just command line
arguments impossible (openocd -f interface/sth.cfg -f
target/sth_else.cfg), as now you have to have your board config file.
Please - don't go this way.
Why would that be impossible? Who prevents you to use a script that sets
*your* clock frequency and includes the target script?
You don't get my point. To run OpenOCD "my way" I don't need ANY scripts
beside standard target/interface files that come with OpenOCD.
For this reply to be constrictive criticism, I suggest you leave 4MHz
default value in case no clock is specified.
I have a crazy idea - I think it is possible to measure frequency of the
external crystal (and check for it's existence) with simple code using
one timer. This way OpenOCD would work without specifying this
frequency. It could then - before programming - measure it (backup-ing
all settings of timer), switch PLL to max value (using external crystal
or internal resonator, also backup-ing all settings of clock and PLL),
flash, revert all changes made to clock, PLL and timer and voila [;
Problem gone
4\/3!!
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development