Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Inserting C-code in assembly language

Status
Not open for further replies.
Yes it is definetely possible.... which controller and IDE are you using....

**broken link removed**
**broken link removed**

I will try to explain your steps more precisely. What you exactly need to do is:
1) Insert your assembly lines between #pragma asm/#pragma endasm statements
2) Start the file_name.c file with #pragma src (it must be the first line there)
3) Insert file_name.src - this file will be generated during compilation process - inside your project.

Of course, this can be done automagicaly inside uVision2, at least it is described so inside C51.PDF,
 

Some of compliers allows writing assembly language code with C language. In this case you need to you need to specify starting and ending of assembly code with in C code. But I don't think you can add C code in assembly. Assembly code is converted in to machine code by assembler while C code requires a complier.
 

Hi,
Thank you Shivram Sir,
I am using C30 compiler
It is very hard to find any sample code of this
 

I am using C30 compiler
It is very hard to find any sample code of this
When mixing C and assembly language , you'll need to process the source with a C-compiler rather than an assembler. So whatever you define it, the actual problem is to insert assembler into C-code, because the latter is the compiler's native language. But that's no problem so far.

Regarding syntax details, did you notice that C30 is shipped with a lot of manuals and help files? That's basically the place to search for the mixed language syntax. Im also sure that you'll find examples.

Generally, you should consider, that using C code has some prerequisites. In most cases, it has to be embedded in a C based application, involving startup code, libraries, stack initialization, reserving registers and so on. The idea of inserting C-code into assembly language may also conflict with these requirements.

P.S.: If you tell more about your intentions, we can possibly give detailed suggestions.
 

Yes FVM is correct..... the modification of the startup code has to be very carefully and with some good expertise level....
the Help in the IDE are always the best helping manual we can get......
 

Hi ,
Actually I need to use the bootloader for my project.
So we already built our own controller board. When i test the ds30 bootloader application
it is not working, but it works with the Explorer16 development board. So i am troubleshooting it.
I didn't got the result with our own board.

So what are the things to be checked? Can you suggest some ideas

Thanks
 

So what are the things to be checked? Can you suggest some ideas
Trace the bootloader execution with a hardware debug adapter in MPLAB and check where it fails. That's what I do in a similar case, and the method was always successful up to now.
 

Hi,
I checked the hardware. The MAX232 Receiver is working, but it is not transmitting anything
Whether the 'Configuration Bits ' will be the problem?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top