Help using toolchain on custom hardware.

Sysprogs forums Forums Other tools & products Help using toolchain on custom hardware.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #640
    kkeeley
    Participant

    Hi,

    I have been building my own hardware using a 68000 CPU for many years and have always written my code in assembly. I have recently decided that it would be good to finally start writing my programs in a higher language like C and after a lot of problems building the GNU toolchain I found/downloaded and installed the “Prebuilt GNU toolchain for m68k-elf” from this site. The first trials I did was to convert some of my existing assembly code to work with this assembler and then tested the output on both my emulated environment and my hardware, the results where successful and promising. Next step is to get C code compiling correctly for my environment and this is where I’m not getting the results I’m looking for.

    The problem I’m having is that the compiler appears to be trying to use prebuilt libraries and this causes the code to either fail to compile or the code won’t run correctly for my system when I run the code in my emulated environment.

    Can anybody provide me examples of the command options to use for gcc/as/ld to prevent them from using any prebuilt libraries and only use the files I provide the source for or to at least compile correctly for my hardware.

    I have tried options like these but I’m still not getting the results I’m after.
    GCC FLAGS = -nostdinc -nostdlib -nodefaultlibs -Wall -mc68000 -mpcrel
    LD FLAGS = -s -Os –gc-sections -nostdlib -nodefaultlibs

    Thanks
    Kenneth

    #2627
    ket
    Participant

    Hi,

    Those flags should normally avoid using any not explicitly specified libraries. It is hard to say more without even seeing a single error message you are having.
    Of course another thing to remember with cross-compilation is that the shared libraries used for building and running are not necessarily the same.

    #2628
    kkeeley
    Participant

    Hi Ket,
    Thank you for your response. To help every one understand a bit more about what I’m trying to do I will try to explain my hardware setup and what I’m currently trying to program.

    Firstly the hardware is currently based on a 68000 CPU although I am thinking of upgrading it to a 68030 or 68040 at some point, mainly so I can get the memory management unit and access more memory space. The system currently has 1Mb or RAM located at 0x000000 and 256K of Flash ROM located at 0xFC0000 it also has a dual serial interface used for as a terminal interface and an ATA interface connected to a hard drive for storage that are currently located in the 0x800000 range. I have programmed a number of features into the ROM that allows basic system access, ie displaying characters and strings on the terminal, getting characters from the terminal, reading and writing sectors from the hard drive, etc, these are all provide via Trap routines.

    At this time I have the ROM configured to upon power up or reset it will preform a checksum on the ROM followed by testing the first 4KB of RAM if both these test past it will initialize the serial interface and ATA interface. The ROM is also able to look for a master boot sector on a hard drive and if it finds a valid one it will load it into RAM and then run it. The master boot sector can handle checking and loading from different partitions on the hard drive. All of these codes have been written in pure assembly.

    Now I wish to actually write standalone executable files that either the ROM or the boot sector code can load from the hard drive into RAM and execute. Basically the start of a very basic operating system. This is where I’m looking for a bit of help, I’m looking for help on what settings/options I need to use with the compiler and linker to allow the programs to work correctly with my hardware. From what I have found so far I am going to have to write my own C runtime library to allow C code to access my hardware in a standard way.

    If anybody could help provide me samples on how to compile/link my own C runtime library and then how to use that with a simple hello world program that I can then run on my hardware, that would be great. The sample code doesn’t have to be complete, the more import part I feel is the compiler/linker options to build the files correctly.

    Hope this makes more sense now.

    Kenneth

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.