Loading ...
Sorry, an error occurred while loading the content.

How can I use banked memory?

Expand Messages
  • joo0ma
    Dear Everyone, A few days ago, I updated m68hc11-elf-gcc from 1.1.1 to 2.2. Because I have hoped banked-memory supported in GCC, I m so glad to GCC 2.2. But I
    Message 1 of 1 , Jul 1, 2003
    • 0 Attachment
      Dear Everyone,

      A few days ago, I updated m68hc11-elf-gcc from 1.1.1 to 2.2.
      Because I have hoped banked-memory supported in GCC, I'm so glad to
      GCC 2.2.
      But I can't use this functionality. I tried to find the solution in
      Stephane Carrez's web-page and yahoo-group, but it's also impossible
      for myself to finish my question. There are some solutions, in
      Stephane Carrez's page (http://m68hc11.serveftp.org/faq.php?
      file=faq/link/memory_bank-2.txt) and in yahoo group
      (http://groups.yahoo.com/group/gnu-m68hc11/message/2821), but there
      are some differences.
      That is,

      - the default virtual address is now 0x10000 (instead of 0x1000000)

      What does it mean? In Stephane Carrez's pages, the page0 is from
      0x1000000 to 0x100BFFF and the page1 is from 0x1004000 to 1007FFF,
      etc. It's so confusing. Which one is the right answer? In my
      opinion, Stephane Carrez's web page is for GCC-2.11 and there are
      some changes in GCC-2.2. So the pages are not suitable for GCC-2.2,
      right? I'm using GCC & CodeWarrior for compiler and BDM & Hiwave for
      debugger. When I set the bank2 address to 18000, even if following
      Stephane Carrez's web page comments this bank is page 2, but I could
      confirm the code is downloaded in page1 with Hiwave & BDM. As the
      result of these mismatches (between the assembly code (jump to page
      2) made by GCC compiler and the really located page 1), so my code
      is stuck or stopped.

      And in compile time, if I wanted to use the banked memory, what
      options should I use? I use -mlong-calls. Only this option is
      enough? Or not?

      I attached my C-code and memory.x files. Would you review the files?

      #define PORTB *(unsigned char volatile *) 0x0001
      #define DDRB *(unsigned char volatile *) 0x0003
      #define TIOS *(unsigned char volatile *) 0x0040
      #define TCNT *(unsigned short volatile *) 0x0044
      #define TSCR1 *(unsigned char volatile *) 0x0046
      #define TSCR2 *(unsigned char volatile *) 0x004D
      #define TFLG2 *(unsigned char volatile *) 0x004F

      void LedOn(void);

      void main(void){

      void __attribute__((section (".bank1"))) LedOn(void)
      unsigned long delay;
      unsigned short i;
      for (i=1;i<=128;i=i*2) {
      for(delay=0; delay<100000; delay++);

      /* Default Memory locations */
      /* page0 */
      page0 (rwx) : ORIGIN = 0x2000, LENGTH = 0x2400-0x2000

      /* Internal EEPROM */
      rodata : ORIGIN = 0x0800, LENGTH = 2K

      /* Internal Flash ROM */
      text (rx) : ORIGIN = 0xC000, LENGTH = 16K
      text_low (rx) : ORIGIN = 0x04000, LENGTH = 16K
      bank0 (rx) : ORIGIN = 0x10000, LENGTH = 16K
      bank1 (rx) : ORIGIN = 0x18000, LENGTH = 16K
      /* Internal RAM */
      data : ORIGIN = 0x2400, LENGTH = 0x4000-0x2400

      /* Place the Stack at the top of the RAM */
      PROVIDE (_stack = 0x3FFF);

      /*PROVIDE (_vectors_addr = 0xffb6);*/

      .text_low :
      /* Put startup code at beginning so that _start keeps same
      /* Startup code. */
      KEEP (*(.install0)) /* Section should setup the stack
      pointer. */
      KEEP (*(.install1)) /* Place holder for applications. */
      KEEP (*(.install2)) /* Optional installation of data sections
      in RAM. */
      KEEP (*(.install3)) /* Place holder for applications. */
      KEEP (*(.install4)) /* Section that calls the main. */
      KEEP (*(.init))
      } > text
      .bank1 :
      } > bank1


      my development environment

      M68HC912DG128 EVB
      SDI BDM
      Hiwave dbugger


      Dear Stephane Carrez,

      In the above comments(http://groups.yahoo.com/group/gnu-
      m68hc11/message/2821), you prepare the new user's guide/tutorial.
      When do you finish the jobs? May I get the documents? Or could you
      send some/simple example, using the banked memory? (include compile
      & linking option, memory.x, etc.)

      I hope your reply, as soon as you can.

      Thank you. God bless you.
    Your message has been successfully submitted and would be delivered to recipients shortly.