Overtone Labs

Why does one project produce code that runs while another does not?

I'm having a problem getting the C code I write to run on the CUI32.  It compiles and loads and verifies but does not run.

I took the switch.zip file from this site and compiled it and it loaded, verified, and runs fine.  I then replaced all the code in that file with my code.  It compiles, loads, and runs fine!

So the same source code works when placed in the "switch" project but not when placed in a project I start from scratch.  I can find no differences between the two projects:  the includes are the same, every compiler setting I can find is the same, including the build options, config bits (which are set by the program anyway).

Does anyone have any idea what is going on?  What am I missing? 

I'm not clear on how the reset vector gets set, is that maybe the issue?

Views: 47

Reply to This

Replies to This Discussion

The difference is most likely the 'procdefs.ld' file. You can search about this in this forum. Ask again if you cannot find it
Markus,

Thanks for the help. Yes that file, when placed in the same directory as the source code file, makes it all work. However, it makes the simulator not work. So I have to remove it to simulate and then put it back to compile the code for the CUI32.

The procdefs.ld file says it is processor specific, but it is actually more specific than that - is it not? It must be specific to the PIC32MX440F512H with the bootloader in it, right?
Mike Watts said:
It must be specific to the PIC32MX440F512H with the bootloader in it, right?

So you didn't search the forum for postings about the procdefs.ld file. Well, maybe this helps.
No, I found the procdefs.ld file over on the CPUStick site. That discussion makes it clear the file is for that processor with the bootloader - although there is nothing in the file itself that says it is correct for the PIC32MX440F512. Do we know who created the file? Is there an equivalent file for the same chip when the bootloader is not used?
The procdefs.ld file is from the Microchip bootloader example folder. You can find it there. And yes, a linker script is always used.

Mike Watts said:
No, I found the procdefs.ld file over on the CPUStick site. That discussion makes it clear the file is for that processor with the bootloader - although there is nothing in the file itself that says it is correct for the PIC32MX440F512. Do we know who created the file? Is there an equivalent file for the same chip when the bootloader is not used?
Thanks Markus. It is painful but I'm catching on. I've created my first real embedded C program. It controls relays that switch AC power to inductive loads on the zero crossing of the AC current going into the load. This protects relay contacts, prevents arcing, replaces "snubbers", reduces (almost eliminates) RFI generation, reduces isolation voltage requirements, reduces surge currents, etc. Works like a champ!

Again, thanks for your coaching.

Mike
Sounds interresting. Maybe you want to post some photos, schematics, source code...

Mike Watts said:
Thanks Markus. It is painful but I'm catching on. I've created my first real embedded C program. It controls relays that switch AC power to inductive loads on the zero crossing of the AC current going into the load. This protects relay contacts, prevents arcing, replaces "snubbers", reduces (almost eliminates) RFI generation, reduces isolation voltage requirements, reduces surge currents, etc. Works like a champ! Again, thanks for your coaching.

Mike
Ok, here's the write up on Using a MicroController to Perform Zero-Crossing Switching of Inductive AC Loads. If you don't want to bother to download it (it's a little bit large - I don't have winzip on this machine), it is also posted on my web site at

http://wy6k.com/homebrew_stuff/Zero%20Crossing%20with%20a%20MicroCo...

Mike
Attachments:
Nice writeup. Thank you. 

Mike Watts said:
Ok, here's the write up on Using a MicroController to Perform Zero-Crossing Switching of Inductive AC Loads. If you don't want to bother to download it (it's a little bit large - I don't have winzip on this machine), it is also posted on my web site at http://wy6k.com/homebrew_stuff/Zero%20Crossing%20with%20a%20MicroCo...

Mike

Reply to Discussion

RSS

© 2013   Created by Dan Overholt.

Badges  |  Report an Issue  |  Terms of Service