Alright, here's the beef. I'm basically writing a program for a PIC18 microcontroller. There's just one problem, my main asm file, it compiles C into assembly and then turns it into bytecode, is too big to be loaded into memory. So I'm getting compiler errors telling me the section is too long. It's not a very high end microcontroller, but I'm still pretty surprised I hit its limit so fast.
My program has a copious amount of char arrays, size 17. I did some removal of the parts of the program concerning the char arrays. I then declared them before the main method. It didn't compile. When I removed them, it compiled.
I was thinking of splitting up some of the methods into another file. How do I do that ? How do I access said external methods from the class file containing the main method.
Alternatively, a simple way to fix this would be to tell me a way to store some char arrays in another file. I would also need to know how to access them using the main method file.
I was schooled in Java, so I'm not sure how to go about doing this in C. Normally I would make a constructor for an object in that external file. Make that keep all the arrays. Then use dot operators to access the variables I want from the new object.
I'm quite sure I surpassed the maximum size for one such C file. The microcontroller will definitely accept more C files, it has 2 MBs of program space.
C Programmers Help !
Started by marks, Aug 19 2007 09:29 AM
3 replies to this topic
#1
Posted 19 August 2007 - 09:29 AM
|
|
|
#2
Posted 19 August 2007 - 04:03 PM
I have very little experience with your problem, but the first place I would look is your compiler settings. Sure you already looked but its my only suggestion. srry I couldn't really help you
#3
Posted 19 August 2007 - 08:54 PM
Why don't you explicitly code in Assembly, instead of coding in C and then compile it to Assembly. The compiler, or converter you're using could probably edit the sourcecode in some way, and make it bigger than it should. With Assembly you'll get a lot more of control.
You could, as Victor mentioned, check your compiler-settings and/or manual. See if there's some parameters that you can use to leave out stuff, etc.
You could, as Victor mentioned, check your compiler-settings and/or manual. See if there's some parameters that you can use to leave out stuff, etc.
#4
Posted 20 August 2007 - 04:55 AM
Quote
I was thinking of splitting up some of the methods into another file. How do I do that ? How do I access said external methods from the class file containing the main method.
I think what you want to do is create a library. Just like how you need to reference libraries when you use iostream or the such. I've never created my own library before so I can't offer any help there, but I'm sure it's not too difficult.


Sign In
Create Account

Back to top









