Link Error   : Undefined : "_BDT_BASE"

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Link Error   : Undefined : "_BDT_BASE"

1,413 Views
zhelezyaka
Contributor I

Help please!

 

typedef unsigned long int hcc_u32;

 

extern hcc_u32 _BDT_BASE[];
#define BDT_BASE              ((hcc_u32*)(_BDT_BASE))
#define BDT_CTL_RX(ep, b)     (BDT_BASE[((ep)<<3)+((b)<<1)+0])

 

#define WR_LE32(a, v) ((*(hcc_u32*)(a))= v)

 

void main(void) {

  WR_LE32(&BDT_CTL_RX(1,0),1);

}

Labels (1)
0 Kudos
Reply
4 Replies

438 Views
RichTestardi
Senior Contributor II

I believe that should be defined in your Linker File (.lcf).

 

What does yours look like?

 

Mine looks something like:

 

# Sample Linker Command File for CodeWarrior for ColdFire# Memory ranges MEMORY {   page0   (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000800   page1   (RX)  : ORIGIN = 0x00000800, LENGTH = 0x00000800   code    (RX)  : ORIGIN = 0x00001000, LENGTH = 0x0001f000   bdtram  (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00000080   userram (RWX) : ORIGIN = 0x20000080, LENGTH = 0x00003f80}SECTIONS {...  .bdtram : {} > bdtram   ...  ___BDT_RAM = ADDR(.bdtram); ___BDT_RAM_END  = ADDR(.userram);}

 

0 Kudos
Reply

438 Views
zhelezyaka
Contributor I

Thank you very much!
It was necessary to change Project.lcf

 

/* Buffer descriptor base address
   shall be aligned to 512 byte boundary.
   Size shall be 512 bytes. */
    .= ALIGN(512);
    __BDT_BASE          = .;
    .                          = . + 512;
    __BDT_END           = .;

Message Edited by zhelezyaka on 2009-04-02 08:41 PM
0 Kudos
Reply

438 Views
dickb_nevada
Contributor I

I have the same issue with undefined _BDT_BASE.  How should I modify the lcf file to resolve this issue?  Please note that I also have an undefined '_IPSBAR'.

 

My project.lcf file is as follows:

 

# Sample Linker Command File for CodeWarrior for ColdFire MCF51JF128

# Memory ranges

MEMORY

{

   code        (RX)  :

ORIGIN = 0x00000410, LENGTH = 0x0001FBF0

   userram     (RWX) :

ORIGIN = 0x00800000, LENGTH = 0x00008000

}

SECTIONS

{

# Heap and Stack sizes definition

  ___heap_size     = 0x0400;

  ___stack_size    = 0x0400;

# MCF51JF128 Derivative Memory map definitions from linker command files:

# ___RAM_ADDRESS, ___RAM_SIZE, ___FLASH_ADDRESS, ___FLASH_SIZE linker

# symbols must be defined in the linker command file.

# 32 Kbytes Internal SRAM

   ___RAM_ADDRESS = 0x00800000;

   ___RAM_SIZE    = 0x00008000;

# 128 KByte Internal Flash Memory

   ___FLASH_ADDRESS  = 0x00000000;

   ___FLASH_SIZE     = 0x00020000;

 

  .userram        : {} > userram

  .code      : {} > code

  .text :

  {

    *(.text)

    . =

ALIGN (0x4);

    *(.rodata)

    . =

ALIGN (0x4);

    ___ROM_AT = .;

    ___DATA_ROM = .;

  } >> code

 

  .data :

AT(___ROM_AT)

  {

    ___DATA_RAM = .;

    . =

ALIGN(0x4);

    *(.

exception)

    . =

ALIGN(0x4);

    __exception_table_start__ = .;

   

EXCEPTION

    __exception_table_end__ = .;

 

    ___sinit__ = .;

     

STATICINIT

    __START_DATA = .;

 

    *(.data)

    . =

ALIGN (0x4);

    __END_DATA = .;

 

    __START_SDATA = .;

    *(.sdata)

    . =

ALIGN (0x4);

    __END_SDATA = .;

 

    ___DATA_END = .;

    __SDA_BASE = .;

    . =

ALIGN (0x4);

  } >> userram

 

  .bss :

  {

    ___BSS_START = .;

    __START_SBSS = .;

    *(.sbss)

    . =

ALIGN (0x4);

    *(SCOMMON)

    __END_SBSS = .;

 

    __START_BSS = .;

    *(.bss)

    . =

ALIGN (0x4);

    *(COMMON)

    __END_BSS = .;

    ___BSS_END = .;

 

    . =

ALIGN(0x4);

  } >> userram

 

  .custom :

  {

    ___HEAP_START       = .;

    ___heap_addr        = ___HEAP_START;

    ___HEAP_END         = ___HEAP_START + ___heap_size;

    ___SP_END             = ___HEAP_END;

    ___SP_INIT          = ___SP_END + ___stack_size;

 

    ___mem_limit        = ___HEAP_END;

    ___stack_safety     = 16;

 

    . =

ALIGN (0x4);

  } >> userram

 

  __SP_INIT             = ___SP_INIT;

 

  ___SP_AFTER_RESET     = __SP_INIT;

 

  _romp_at = ___ROM_AT +

SIZEOF(.data);

  .romp :

AT(_romp_at)

  {

    __S_romp = _romp_at;

   

WRITEW(___ROM_AT);

   

WRITEW(ADDR(.data));

   

WRITEW(SIZEOF(.data));

   

WRITEW(0);

   

WRITEW(0);

   

WRITEW(0);

  }

}

0 Kudos
Reply

438 Views
RichTestardi
Senior Contributor II

BTW, if you are writing a USB driver from scratch (as it appears you might be), there are a couple of example source code references you can use:

 

1. CMX driver available from Freescale here:

 

    http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=CMX_USB-LITE&fsrch=1

 

2. my driver, in a skeleton source code project (skeleton.zip), at the bottom of this page: 

 

    http://www.cpustick.com/downloads.htm

 

Also, depending on what MCU you are using, and what your USB needs are, you might even find StickOS, on that same downloads page, (with USB device and host mode) might do some of what you want...

 

-- Rich

 

0 Kudos
Reply