EmbeddedRelated.com
Forums

Creating Program to run in RAM

Started by Ken September 9, 2008
I'm trying to compile a program in Dynamic C 9.52 to run in RAM.

The program is part of a boot loader which we wrote some time ago to
program a RCM2260 RabbitCore from an external flash memory card.
The original program was written in Dynamic C 7.25P and has been
working for our application.

When the program is compiled using the earlier version, the file
compiles to a BIN file with only a warning message indicating that BIN
files were intended for programming FLASH and not for running in RAM.
The BIN file however worked for our purposes.

The problem I've run into is when the very same program is compiled
the BIN using Dynamic C 9.52 the resulting BIN file does not work.
Through some investigation of my own I've found that even though I've
selected "Code and BIOS in RAM" when I go to compile the BIN file the
compiler compiles to FLASH and not RAM.

While Dynamic C 9.52 has the option to compile to RAM under the
"Compile to Target" menu option, Dynamic C 9.52 only has compile to
flash options under the "Compile to bin" menu option.

Is it possible with Dynamic C 9.52 to create a BIN file that will run
in RAM? If so, what options or definitions do I need to include in
the compile? If not, then will any of the newer versions of Dynamic C
have this ability?

Is it possible to override the FLASH_COMPILE or RAM_COMPILE macros and
generate a BIN file for use in RAM? I tried a custom BIOS defining
RAM_COMPILE in place of FLASH_COMPILE but that resulted in several
compile errors.

If there is a alternate C compiler for the Rabbit modules available we
might consider switching from Dynamic C but only as a last resort.
The only problem with switching compilers is compatibility with
existing code. We've developed several libraries and have modified
some of the Dynamic C libraries and any new compiler would need to be
compatible.

Any suggestions will be appreciated.

Ken Hendrix
AGM Electronics Inc.

Ken wrote:
> I'm trying to compile a program in Dynamic C 9.52 to run in RAM.
>
> The program is part of a boot loader which we wrote some time ago to
> program a RCM2260 RabbitCore from an external flash memory card.
> The original program was written in Dynamic C 7.25P and has been
> working for our application.
>
> When the program is compiled using the earlier version, the file
> compiles to a BIN file with only a warning message indicating that BIN
> files were intended for programming FLASH and not for running in RAM.
> The BIN file however worked for our purposes.
>
> The problem I've run into is when the very same program is compiled
> the BIN using Dynamic C 9.52 the resulting BIN file does not work.
> Through some investigation of my own I've found that even though I've
> selected "Code and BIOS in RAM" when I go to compile the BIN file the
> compiler compiles to FLASH and not RAM.
>
> While Dynamic C 9.52 has the option to compile to RAM under the
> "Compile to Target" menu option, Dynamic C 9.52 only has compile to
> flash options under the "Compile to bin" menu option.
>
> Is it possible with Dynamic C 9.52 to create a BIN file that will run
> in RAM? If so, what options or definitions do I need to include in
> the compile? If not, then will any of the newer versions of Dynamic C
> have this ability?
>

Set compile options:

Bios and Memory settings: Code and bios in RAM
Default Compile mode: Compile to defined target configuration to a .bin file

Do not use: Compile to .bin file using attached target; IT DOES NOT WORK.

Use F5 to compile a .bin.

I would use 7.25 as it will produce much smaller code and has less bugs.
The only reason i use newer versions is if the module is not supported.

Note: 9.5x can not read the ID block or user block when compiling to
RAM. 7.2x has no problems.

> If there is a alternate C compiler for the Rabbit modules available we
> might consider switching from Dynamic C but only as a last resort.
> The only problem with switching compilers is compatibility with
> existing code. We've developed several libraries and have modified
> some of the Dynamic C libraries and any new compiler would need to be
> compatible.
>
> Any suggestions will be appreciated.
Softools compiler is much easier to use fort custom apps as you have complete control over the memory map. It is ANSI C, make the code more portable but does eliminate some of the DC non-standard features (costates.)

http://www.softools.com/rabbitwinide.htm

All my DLM's are written using the Softools compiler. Usually the .bin
file for the RAM part is less than half the size of the DC. An empty
main() project in DC used to be about 19k in DC 7.x, now it is about
39k. In softools, the same program is 9k. Then for DC, just a small lib
to load the RAM program and run it.
--
------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------
Rabbit libs: http://www.shdesigns.org/rabbit/
today's fortune
Life is a healthy respect for mother nature laced with greed.
Scott Henion wrote:
> Set compile options:
>
> Bios and Memory settings: Code and bios in RAM
> Default Compile mode: Compile to defined target configuration to a .bin file
>
> Do not use: Compile to .bin file using attached target; IT DOES NOT WORK.
>
> Use F5 to compile a .bin.
>
> I would use 7.25 as it will produce much smaller code and has less bugs.
> The only reason i use newer versions is if the module is not supported.
>
> Note: 9.5x can not read the ID block or user block when compiling to
> RAM. 7.2x has no problems.
>
Also make sure the board type is set in the targetless compile options.
9.5x seems to randomly change it.

--
------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------
Rabbit libs: http://www.shdesigns.org/rabbit/
today's fortune

So, like us, let your children run wild and free, because as the old
saying goes, let your children run wild and free.

-- Homer Simpson
Bart vs. Australia
Thanks Scott,

I'll give your suggestions a try.

I may also check out Soft tools. I'm not using any costates, but I also don't want to rewrite everything I've done so far. I wish Rabbit would have stuck with ANSI C to begin with. I program in both the Windows and Rabbit environment so sometimes I forget about the little quirks of Dynamic C.

I've also noticed the size differences between 7.25 and 9.52. We probably would not have upgraded to 9.25 if it was not for some of the improvements in the TCP libraries that 9.52 has. I would prefer to keep just a single version of the C compiler and have everything under that version.

Ken

Original Message ----
From: Scott Henion
To: r...
Sent: Tuesday, September 9, 2008 11:35:23 AM
Subject: Re: [rabbit-semi] Creating Program to run in RAM
Ken wrote:
> I'm trying to compile a program in Dynamic C 9.52 to run in RAM.
>
> The program is part of a boot loader which we wrote some time ago to
> program a RCM2260 RabbitCore from an external flash memory card.
> The original program was written in Dynamic C 7.25P and has been
> working for our application.
>
> When the program is compiled using the earlier version, the file
> compiles to a BIN file with only a warning message indicating that BIN
> files were intended for programming FLASH and not for running in RAM.
> The BIN file however worked for our purposes.
>
> The problem I've run into is when the very same program is compiled
> the BIN using Dynamic C 9.52 the resulting BIN file does not work.
> Through some investigation of my own I've found that even though I've
> selected "Code and BIOS in RAM" when I go to compile the BIN file the
> compiler compiles to FLASH and not RAM.
>
> While Dynamic C 9.52 has the option to compile to RAM under the
> "Compile to Target" menu option, Dynamic C 9.52 only has compile to
> flash options under the "Compile to bin" menu option.
>
> Is it possible with Dynamic C 9.52 to create a BIN file that will run
> in RAM? If so, what options or definitions do I need to include in
> the compile? If not, then will any of the newer versions of Dynamic C
> have this ability?
>

Set compile options:

Bios and Memory settings: Code and bios in RAM
Default Compile mode: Compile to defined target configuration to a .bin file

Do not use: Compile to .bin file using attached target; IT DOES NOT WORK.

Use F5 to compile a .bin.

I would use 7.25 as it will produce much smaller code and has less bugs.
The only reason i use newer versions is if the module is not supported.

Note: 9.5x can not read the ID block or user block when compiling to
RAM. 7.2x has no problems.

> If there is a alternate C compiler for the Rabbit modules available we
> might consider switching from Dynamic C but only as a last resort.
> The only problem with switching compilers is compatibility with
> existing code. We've developed several libraries and have modified
> some of the Dynamic C libraries and any new compiler would need to be
> compatible.
>
> Any suggestions will be appreciated.
Softools compiler is much easier to use fort custom apps as you have complete control over the memory map. It is ANSI C, make the code more portable but does eliminate some of the DC non-standard features (costates.)

http://www.softools .com/rabbitwinid e.htm

All my DLM's are written using the Softools compiler. Usually the .bin
file for the RAM part is less than half the size of the DC. An empty
main() project in DC used to be about 19k in DC 7.x, now it is about
39k. In softools, the same program is 9k. Then for DC, just a small lib
to load the RAM program and run it.

--
------------ --------- --------- --------- ---
| Scott G. Henion| shenion@shdesigns. org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesign s.org |
------------ --------- --------- --------- ---
Rabbit libs: http://www.shdesign s.org/rabbit/
today's fortune
Life is a healthy respect for mother nature laced with greed.