This is an automated email from Gerrit.

Andrey Smirnov ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/2108

-- gerrit

commit fa861f2d40a4f4bddbd298de12f33f5867d3dc34
Author: Andrey Smirnov <[email protected]>
Date:   Sun Apr 13 16:00:24 2014 -0700

    contrib/loaders/flash: Add source for helper from S12XFTM driver
    
    Add source code used to generate a binary for helper program used in
    S12XFTM driver.
    
    Developed against MC9S12XE and DEMO09S12XEP100 dev board.
    
    Change-Id: I893631b0c79e5da19674a58fdf952fc2b38939eb
    Signed-off-by: Andrey Smirnov <[email protected]>

diff --git a/contrib/loaders/flash/s12xftm/.gitignore 
b/contrib/loaders/flash/s12xftm/.gitignore
new file mode 100644
index 0000000..ead0677
--- /dev/null
+++ b/contrib/loaders/flash/s12xftm/.gitignore
@@ -0,0 +1,4 @@
+*.lss
+*.bin
+*.elf
+!Makefile
\ No newline at end of file
diff --git a/contrib/loaders/flash/s12xftm/Makefile 
b/contrib/loaders/flash/s12xftm/Makefile
new file mode 100644
index 0000000..4bb4203
--- /dev/null
+++ b/contrib/loaders/flash/s12xftm/Makefile
@@ -0,0 +1,36 @@
+MCU   ?= mc9s12xe
+TARGET = ocd-helper
+
+SRCS   = main.c
+OBJS = $(SRCS:.c=.o)
+
+PREFIX ?= m68hc11-elf-
+
+OBJCOPY = $(PREFIX)objcopy
+CC      = $(PREFIX)gcc
+OBJDUMP = $(PREFIX)objdump
+RM = rm
+CP = cp
+
+CFLAGS  = -m68hc12 -O2 -fno-ident -fno-common -fomit-frame-pointer -mshort 
-nostdlib
+LDFLAGS = -T$(MCU)-memory.ld -T$(MCU).ld
+OBJCOPYFLAGS =
+INCDIR = -I./include -I../../../../src -I../../../../src/helper  
-I../../../../jimtcl
+
+all:   $(TARGET).elf $(TARGET).bin $(TARGET).lss
+
+$(OBJS): %.o: %.c
+       $(CC) $(CFLAGS) $(INCDIR) -c $<
+
+$(TARGET).elf: $(OBJS) $(MCU).ld $(MCU)-memory.ld
+       $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
+
+$(TARGET).bin: $(TARGET).elf
+       $(OBJCOPY) -O binary $< $@
+
+$(TARGET).lss: $(TARGET).elf
+       $(OBJDUMP) -h -S $< > $@
+
+.PHONY: clean
+clean:
+       $(RM) -rf $(OBJS) *.elf *.bin *.lss;
diff --git a/contrib/loaders/flash/s12xftm/main.c 
b/contrib/loaders/flash/s12xftm/main.c
new file mode 100644
index 0000000..d27d1e3
--- /dev/null
+++ b/contrib/loaders/flash/s12xftm/main.c
@@ -0,0 +1,66 @@
+/***************************************************************************
+ *                                                                         *
+ *   Copyright (C) 2014 by Andrey Smirnov                                  *
+ *   [email protected]                                              *
+ *                                                                         *
+ *   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; see the file COPYING.  If not see            *
+ *   <http://www.gnu.org/licenses/>                                        *
+ *                                                                         *
+ ***************************************************************************/
+
+/*
+  WARNING! WARNING! WARNING!
+
+  When making changes to this code, please make sure to inspect the
+  resulting assembly and verify that all generated code is position
+  independent. When allocating memory space on the target OpenOCD does
+  not give any guaranteees that the start address of it would have any
+  specific value, so it is important to us to be able to function when
+  placed at an arbitrary offset.
+
+  WARNING! WARNING! WARNING!
+ */
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <helper/log.h>
+#include <flash/nor/s12xftm.h>
+
+static inline void bgnd(void) __attribute__((naked, noreturn));
+static inline void bgnd(void)
+{
+       __asm__ __volatile__ ("bgnd");
+}
+
+int main(void) __attribute__((naked, noreturn));
+int main(void)
+{
+       register uint16_t x __asm__("x");
+
+       struct s12xftm_helper_context *context = (struct s12xftm_helper_context 
*)x;
+
+       switch (context->command) {
+       case S12XFTM_HELPER_CMD_PERF:
+               while (--context->in.perf.counter)
+                       ;
+
+               context->out.retcode = ERROR_OK;
+               break;
+
+       default:
+               break;
+       }
+
+       bgnd();
+}
diff --git a/contrib/loaders/flash/s12xftm/mc9s12xe-memory.ld 
b/contrib/loaders/flash/s12xftm/mc9s12xe-memory.ld
new file mode 100644
index 0000000..ddef2d3
--- /dev/null
+++ b/contrib/loaders/flash/s12xftm/mc9s12xe-memory.ld
@@ -0,0 +1,4 @@
+MEMORY
+{
+       RAM  (rx)  : ORIGIN = 0x02000, LENGTH = 0x2000
+}
diff --git a/contrib/loaders/flash/s12xftm/mc9s12xe.ld 
b/contrib/loaders/flash/s12xftm/mc9s12xe.ld
new file mode 100644
index 0000000..89612a1
--- /dev/null
+++ b/contrib/loaders/flash/s12xftm/mc9s12xe.ld
@@ -0,0 +1,25 @@
+OUTPUT_FORMAT("elf32-m68hc12", "elf32-m68hc12",
+             "elf32-m68hc12")
+OUTPUT_ARCH(m68hc12)
+ENTRY(main)
+
+/* Fixed definition of the available memory banks.
+   See generic emulation script for a user defined configuration.  */
+
+/* Setup the stack on the top of the data memory bank.  */
+PROVIDE (_stack = 0x01100 + 0x6F00 - 1);
+SECTIONS
+{
+  /* Concatenate .page0 sections.  Put them in the page0 memory bank
+     unless we are creating a relocatable file.  */
+  .page0 :
+  {
+    *(.page0)
+  }  > RAM
+  .text  :
+  {
+    *(.text)
+    *(.text.*)
+    . = ALIGN(2);
+  }  > RAM
+}

-- 

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to