EmbeddedRelated.com
Forums

Using Visual C/C++ to do 8051 development

Started by Ed February 5, 2004
I am working on an 8051 project. The code size has grown very large. I
am currently using code banking which makes compiling and linking of the
code very time consuming. For example to do a re-build take about 2+
minutes using the Keil Compiler. I know that some people have used
Visual C/C++ 6.0 to do 8051 development (these are systems where there
is almost no assembly except for the startup module supplied with the
compiler vendor) in order to speed things up. Do you have any experience
with this? Like maybe writing DLLs to simulate 8051 peripherals? Any
info would be appreciated.
On 5 Feb 2004 08:16:23 -0800, Ed wrote:
<snip>
> I know that some people have used > Visual C/C++ 6.0 to do 8051 development (these are systems where there > is almost no assembly except for the startup module supplied with the > compiler vendor) in order to speed things up. Do you have any experience > with this? Like maybe writing DLLs to simulate 8051 peripherals? Any > info would be appreciated.
Huh?
Ed wrote:

> I am working on an 8051 project. The code size has grown very large. I > am currently using code banking which makes compiling and linking of the > code very time consuming. For example to do a re-build take about 2+ > minutes using the Keil Compiler. I know that some people have used > Visual C/C++ 6.0 to do 8051 development (these are systems where there > is almost no assembly except for the startup module supplied with the > compiler vendor) in order to speed things up. Do you have any experience > with this? Like maybe writing DLLs to simulate 8051 peripherals? Any > info would be appreciated.
What is your application? I keep hearing of 8051 projects with so much code that they need banking but I have no idea what they might be. Can you enlighten me? Just curious. Ian
efeten@laars.com (Ed) wrote in
news:cef06b19.0402050816.4fc61d41@posting.google.com: 

> I am working on an 8051 project. The code size has grown very large. I > am currently using code banking which makes compiling and linking of the > code very time consuming. For example to do a re-build take about 2+ > minutes using the Keil Compiler. I know that some people have used > Visual C/C++ 6.0 to do 8051 development (these are systems where there > is almost no assembly except for the startup module supplied with the > compiler vendor) in order to speed things up. Do you have any experience > with this? Like maybe writing DLLs to simulate 8051 peripherals? Any > info would be appreciated.
I've used VC6.0 (no C++ of course) to debug complex algs. when I don't have a good emulator or JTAG debugger available. I've also created test harnesses in VC6 and plopped 8051-destined statemachines and functions into the test harness. I've done all this in ISO C in as much as I could by using #defines to remove issues with Keil C51 extenstions such as data, idata, xdata etc. Of course using fixed bit types with a win32 and 8051 header file is a requirement. That is, typedef'ing unsigned char as a U8, signed char as S8, etc. -- - Mark -> --
Ed,

	I heard a while back that someone built a bunch of macros to
	_assemble_ 8051 code. I followed a dead link.

	I think you understand that a cross compiler is needed to
	compile to the 8051 family. So as others mentioned, debugging
	code and a familiar editor is all Vc++ will give you.

	hamilton


Ed wrote:
> I am working on an 8051 project. The code size has grown very large. I > am currently using code banking which makes compiling and linking of the > code very time consuming. For example to do a re-build take about 2+ > minutes using the Keil Compiler. I know that some people have used > Visual C/C++ 6.0 to do 8051 development (these are systems where there > is almost no assembly except for the startup module supplied with the > compiler vendor) in order to speed things up. Do you have any experience > with this? Like maybe writing DLLs to simulate 8051 peripherals? Any > info would be appreciated.
"Ed" <efeten@laars.com> schreef in bericht
news:cef06b19.0402050816.4fc61d41@posting.google.com...
> I am working on an 8051 project. The code size has grown very large. I > am currently using code banking which makes compiling and linking of the > code very time consuming. For example to do a re-build take about 2+ > minutes using the Keil Compiler. I know that some people have used > Visual C/C++ 6.0 to do 8051 development (these are systems where there > is almost no assembly except for the startup module supplied with the > compiler vendor) in order to speed things up. Do you have any experience > with this? Like maybe writing DLLs to simulate 8051 peripherals? Any > info would be appreciated.
I did that once for a 8051 serial terminal with graphic LCD. The first step was a header that redefines Keil keywords, such as redefining SFR into an unsigned char and redefining interrupt into whitespace. The 'windows' version of the software had some extra files, doing the blitting of the LCD bitmap to the screen every 0.1 second or so, and used a serial port com thread, which did not much else than loading the received character into the SFR and calling the 8051 interrupt function. Likewise, characters from the PC's keyboard or translated mouseclicks on the screen where sent to the '8051' function that used to called from the multiplexed 8051 keyboard scan. The windows software also scanned the non existing ports for key presses, but never saw a key pressed of course. And a few conditional compiles sections were needed, to handle some more obscure things such as the beeper, which was then handled by sending a wav-file through the multimedia api. The final result looked pretty much the same as the real thing, and it was quite useful. Quite reliable too, in most cases after some heavy changes and making it all work on the PC, the 8051 code would run also, after the first rebuild using the Keil compiler. -- Thanks, Frank. (remove 'x' and 'invalid' when replying by email)
Ed wrote:
> I am working on an 8051 project. The code size has grown very large. I > am currently using code banking which makes compiling and linking of the > code very time consuming. For example to do a re-build take about 2+ > minutes using the Keil Compiler. I know that some people have used > Visual C/C++ 6.0 to do 8051 development (these are systems where there > is almost no assembly except for the startup module supplied with the > compiler vendor) in order to speed things up. Do you have any experience > with this? Like maybe writing DLLs to simulate 8051 peripherals? Any > info would be appreciated.
You can check the HAL part of the jayacard project : http://cvs.sourceforge.net/viewcvs.py/jayacard/jayacard/proto/hal/ You will found some technics to simulate 8051 memory and to have C source code compile under both Keil-C and Visual C++ environment. This can give you some ideas (our project is simple thought : no interrupt, no real-time, ...) Hope this helps ! -- Gilles Dumortier mailto:dgil@ieee.org or http://www.ObHack.com Disclaimer: Views expressed here are casual comments and should not be relied upon as the basis for decisions of consequence.
In article <cef06b19.0402050816.4fc61d41@posting.google.com>, Ed
<efeten@laars.com> writes
>I am working on an 8051 project. The code size has grown very large. I >am currently using code banking which makes compiling and linking of the >code very time consuming. For example to do a re-build take about 2+ >minutes using the Keil Compiler. I know that some people have used >Visual C/C++ 6.0 to do 8051 development (these are systems where there >is almost no assembly except for the startup module supplied with the >compiler vendor) in order to speed things up. Do you have any experience >with this? Like maybe writing DLLs to simulate 8051 peripherals? Any >info would be appreciated.
This is a backwards step. Using a Microsoft compiler will SLOW things down. 1 It can not compile 8051 code. If does not understand the Keil or 8051 extensions. 2 Because of 1 the code will be larger and less efficient 3 Given 1 and 2 you will have to spend time porting the code from MS to Keil C51 and have more room for errors. 4 The Keil simulator is accurate. The MS simulator pointless for debugging a C51 program. 5 The MS compiler does not understand banking. Why would you want to use the wrong tools? What is the application? /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
In article <cef06b19.0402050816.4fc61d41@posting.google.com>, 
efeten@laars.com says...
> I am working on an 8051 project. The code size has grown very large. I > am currently using code banking which makes compiling and linking of the > code very time consuming. For example to do a re-build take about 2+ > minutes using the Keil Compiler. I know that some people have used > Visual C/C++ 6.0 to do 8051 development (these are systems where there > is almost no assembly except for the startup module supplied with the > compiler vendor) in order to speed things up. Do you have any experience > with this? Like maybe writing DLLs to simulate 8051 peripherals? Any > info would be appreciated.
2 MINUTES? That doesn't even give me enough time to get another cup of coffee. When it takes 25 minutes to do a complete build, then you can start looking for speedups. --Gene
In comp.arch.embedded
Gene S. Berkowitz <first.last@comcast.net> wrote:

>In article <cef06b19.0402050816.4fc61d41@posting.google.com>, >efeten@laars.com says... >> I am working on an 8051 project. The code size has grown very large. I >> am currently using code banking which makes compiling and linking of the >> code very time consuming. For example to do a re-build take about 2+ >> minutes using the Keil Compiler. I know that some people have used >> Visual C/C++ 6.0 to do 8051 development (these are systems where there >> is almost no assembly except for the startup module supplied with the >> compiler vendor) in order to speed things up. Do you have any experience >> with this? Like maybe writing DLLs to simulate 8051 peripherals? Any >> info would be appreciated. > > >2 MINUTES? >That doesn't even give me enough time to get another cup of coffee. >When it takes 25 minutes to do a complete build, then you can start >looking for speedups.
I agree Gene, this guy is spoiled. A full rebuild on my project takes about 18 minutes then another 7 to burn the image into flash to test. It sure makes you think hard about your changes.