[Openocd-development] [PATCH] script: support only Tcl comments

2010-12-18 Thread Øyvind Harboe
Only Tcl comments are now supported. For classic style
commands comments were supported at the end of the line.

Move in the direction of letting the script language
decide syntax, rather than have special rules for some
commands.

Before this patch goes in, the scripts should be updated
to use ;# instead of # for end of line comments.

> mdw 0 1 2
mdw ['phys'] address [count]
  zy1000.cpu mdw address [count]
Command handler execution failed
in procedure 'mdw'
> mdw 0 1 #2
mdw ['phys'] address [count]
  zy1000.cpu mdw address [count]
Command handler execution failed
in procedure 'mdw'
> mdw 0 1 ;#2
0x: 
> mdw 0 1
0x: 
> mdw 0
0x: 

Signed-off-by: Øyvind Harboe 
---
 src/helper/command.c |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/src/helper/command.c b/src/helper/command.c
index af1d66f..fd5e5f9 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -144,11 +144,6 @@ void script_debug(Jim_Interp *interp, const char *name,
{
int len;
const char *w = Jim_GetString(argv[i], &len);
-
-   /* end of line comment? */
-   if (*w == '#')
-   break;
-
char * t = alloc_printf("%s %s", dbg, w);
free (dbg);
dbg = t;
@@ -175,10 +170,6 @@ static const char **script_command_args_alloc(
{
int len;
const char *w = Jim_GetString(argv[i], &len);
-   /* a comment may end the line early */
-   if (*w == '#')
-   break;
-
words[i] = strdup(w);
if (words[i] == NULL)
{
-- 
1.7.0.4

___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PATCH] script: support only Tcl comments

2010-12-18 Thread Antonio Borneo
On Sat, Dec 18, 2010 at 5:21 PM, Øyvind Harboe  wrote:
> Before this patch goes in, the scripts should be updated
> to use ;# instead of # for end of line comments.

Patch in attachment, compressed since too big.
The replacement of '#' with ';#' has been done through scripts then,
during manual review,
added spaces, here and there, to keep indentation inside multi-line comments.

Best Regards,
Antonio Borneo


0001-TCL-fix-non-TCL-comments.patch.gz
Description: GNU Zip compressed data
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Problem loading to CFI flash

2010-12-18 Thread Andreas Fritiofson
On Fri, Dec 17, 2010 at 4:36 PM, Jonathan dumaresq
 wrote:
> Hi all,
>
> Here my first patches to be able to use the CFI driver on cortex M3 with the
> helper code on target. This is probably not the better way of doing it, but
> at least it's work. This have been tested on real hardware. The default cfg
> that enable the fsmc can be used. Right now only the 16 bit interface has
> been tested. I can add the 8 and 32 bit if the patch is correct.
>
> From my testing, I got 17KB/sec
>
> I'll apreciate a feedback for thoses patches. Since this is nearly my first
> git pacthes...
>
> Regards
>
> Jonathan Dumaresq

Just drop patch #3 and replace 'b done' with 'bkpt #0' in patch #1
(and the corresponding opcode in patch #2). No need to add a
breakpoint programmatically. Look at the other armv7-m algorithms.

Otherwise it looks good to me, but I'm no expert on the cfi-code.
Maybe the armv4_5_info naming is a bit odd if it now contains
armv7-related stuff, though.

/Andreas
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Help needed for SAM3S4C

2010-12-18 Thread Andreas Fritiofson
On Fri, Dec 17, 2010 at 6:27 PM, Kenan Özdemir  wrote:
> Hi,
>
> i start working with the SAM3S4C, but having trouble with openOCD. When I
> start debugging, the very first instructions are working fine, but after the
> 3rd instruction, its jumping acrross the code.
>
> This is my main.cpp
>
>
> int
> main(void) {
>    int a, i = 0;
>    a = 5;
>
>    for(i = 0; i <10; i++)
>   a = a+5;
>
> }
>
> the first instructions (int a, i = 0; and a = 5;) are working. At the
> begining when the curser is at int a... the PC is pointing to 400107 (the
> next instruction a = 5).
>
> When I press step into, the curser goes to a = 5 and the PC is pointing to
> the next instruction (for(i...)), but when i press step into again, it jumps
> into the adress 400d50.
>

I suspect that you're wrongly assuming that the execution flow follows
line-by-line in source code order. That's not the case for any but
possibly the lowest compiler optimization settings. The compiler will
reorder and remove your statements at will, as long as semantics,
according to the C standard, are unchanged. In your case the entire
loop will be removed since it doesn't DO anything. The jump to 400d50
is probably where your main() returns to. In fact, your main() is
semantically equivalent to
int
main(void)
{
}

It's sometimes very hard to debug strongly optimized code, so you
might want to turn optimization off if you need to step around a lot.

/Andreas
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Problem loading to CFI flash

2010-12-18 Thread Michael Schwingen
Am 12/17/2010 04:36 PM, schrieb Jonathan dumaresq:
> Hi all,
>
> Here my first patches to be able to use the CFI driver on cortex M3 with the
> helper code on target. This is probably not the better way of doing it, but
> at least it's work. This have been tested on real hardware. The default cfg
> that enable the fsmc can be used. Right now only the 16 bit interface has
> been tested. I can add the 8 and 32 bit if the patch is correct. 
>
> From my testing, I got 17KB/sec
>
> I'll apreciate a feedback for thoses patches. Since this is nearly my first
> git pacthes... 
I only did a short look, but this looks fine to me.

I think it is time to re-factor that target-algorithm code and pull the
target dependencies out of the CFI code, but that would be a separate step.

cu
Michael

___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Help needed for SAM3S4C

2010-12-18 Thread Kenan Özdemir
Sorry I forgot to tell you that after a couple of steps, it is returning to 
the main routine and then keeps executing the rest of the code


--
From: "Andreas Fritiofson" 
Sent: Saturday, December 18, 2010 8:18 PM
To: "Kenan Özdemir" 
Cc: 
Subject: Re: [Openocd-development] Help needed for SAM3S4C


On Fri, Dec 17, 2010 at 6:27 PM, Kenan Özdemir  wrote:

Hi,

i start working with the SAM3S4C, but having trouble with openOCD. When I
start debugging, the very first instructions are working fine, but after 
the

3rd instruction, its jumping acrross the code.

This is my main.cpp


int
main(void) {
   int a, i = 0;
   a = 5;

   for(i = 0; i <10; i++)
  a = a+5;

}

the first instructions (int a, i = 0; and a = 5;) are working. At the
begining when the curser is at int a... the PC is pointing to 400107 (the
next instruction a = 5).

When I press step into, the curser goes to a = 5 and the PC is pointing 
to
the next instruction (for(i...)), but when i press step into again, it 
jumps

into the adress 400d50.



I suspect that you're wrongly assuming that the execution flow follows
line-by-line in source code order. That's not the case for any but
possibly the lowest compiler optimization settings. The compiler will
reorder and remove your statements at will, as long as semantics,
according to the C standard, are unchanged. In your case the entire
loop will be removed since it doesn't DO anything. The jump to 400d50
is probably where your main() returns to. In fact, your main() is
semantically equivalent to
int
main(void)
{
}

It's sometimes very hard to debug strongly optimized code, so you
might want to turn optimization off if you need to step around a lot.

/Andreas


___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PATCH] script: support only Tcl comments

2010-12-18 Thread Øyvind Harboe
Fantastic! Thanks! :-)

Merged.



-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 63 25 00

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Proposal: update IXP42x config files

2010-12-18 Thread Øyvind Harboe
Hi Michael,

you'll have to rebase your patch on top of the master branch and
update the comments to use ;# at the end of lines as the master
branch now follows tcl rules for comments.

";" => new statement, therefore ;# is effectively a statement
"at the beginning of the line" if you will...


-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 63 25 00

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PATCH] Add support for Hilscher netX controllers

2010-12-18 Thread Øyvind Harboe
Merged.

Thanks!



-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 63 25 00

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Help needed for SAM3S4C

2010-12-18 Thread Michael Schwingen
Am 12/18/2010 09:05 PM, schrieb Kenan Özdemir:
> Sorry I forgot to tell you that after a couple of steps, it is
> returning to the main routine and then keeps executing the rest of the
> code
An embedded system has nowhere to go after you exit "main", so it might
crash, restart, and re-enter main from the beginning - what happens
exactly is usually undefined.

You need to make sure main never exits.

cu
Michael


___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Problem loading to CFI flash

2010-12-18 Thread Antonio Borneo
On Sun, Dec 19, 2010 at 3:56 AM, Michael Schwingen
 wrote:
> I think it is time to re-factor that target-algorithm code and pull the
> target dependencies out of the CFI code, but that would be a separate step.

Fully agree!
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


[Openocd-development] Reorganizing the target/board scripts

2010-12-18 Thread Øyvind Harboe
How about having target scripts export a proc as the default
behavior rather than just executing statements?

This would get rid of using (effectively global)variables as
a way to communicate with these scripts.

A proc also opens up for handling variations of targets in
a single script.

A stab at target/at91sam7sx.cfg:

# tcl supports variable number of arguments, but isn't that
# back to square one?
proc setup_target_args {chipname biglittle id} {

   #use combined on interfaces or targets that can't set TRST/SRST separately
  reset_config srst_only srst_pulls_trst

  set _CHIPNAME $chipname

...
}

# Default target
proc setup_target {} {
   setup_target_args at91sam7s  little 0x3f0f0f0f
}


To invoke:

source [find target/at91sam7sx.cfg]
setup_target

Or shorthand with a proc:

load_config at91sam7sx

-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 63 25 00

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development