> >Or better yet learn to do it right from the start and use the linker. That > >way you won't care where general RAM starts, only what bank it is in. > > Amen to that. > > There is a slight problem with that recommendation, though. The step > from simple single-file absolute coding to relocatable coding looks > *much* bigger than it really is. I don't have a good answer to that. As you said, it may look much bigger than it really is, but it's not much different from using any other linker. I think the problem is not the few additional things you need to learn to use the linker, but the fact that absolute code is even an option in the first place. As I've said before, Microchip seems to have smart EEs designing their microcontrollers, but they don't seem to have real software engineers thinking about how to use the microcontrollers and figuring out what the tools should look like. It feels like this is done by EEs that have learned to program a bit, but don't know much about software engineering. Microchip has done a huge disservice to the world of firmware by even having a non-linked mode of programming at all. They then compounded their stupidity with outright irresponsibility by writing all their examples in absolute mode. If the examples were written in relocatable mode we probably wouldn't be having this discussion. Absolute mode would be a curiosity of the assembler for archaic reasons, and nobody would give it much thought. Everybody just accepts that you need to use the linker to make an executable when writing code for windows. Nobody suggests you should start out in absolute mode because it's "easier" for the beginner. And let's get another thing straight while we're at it. Using the linker doesn't make all the code "relocatable", it's only called that. I've actually been asked "how do you write an interrupt routine with relocatable code since it has to start at fixed address 4"? Using the linker only *allows* code to be relocatable, but you can still force sections of code and data to specific addresses, you just use different directives (another Microchip stupidity, there is no reason ORG couldn't have pretty much the same meaning when using the linker). > Most, if not all, beginners' tutorials are written using absolute > coding. Have you ever seen good tutorial on relocatable coding? There > may be a good one out there somewhere but, if there is, I've never > seen it. I haven't seen one either. Yet another reason not to use tutorials. There is still no substitute for sitting down and reading the damn manual! Once you've read the manual, you won't need a tutorial. It's all in there, and it's really not that hard to understand. The PIC tutorials and intro books just waste your time by slowing down the learning process at best, or teach you bad habits at worst. It seems too many people have come to expect an "xxx For Dummies" book for whatever they are trying to learn as a substitute for doing any real work to learn it. That may be OK for some subjects, but programming microcontrollers isn't for dummies, and in the end will take a little time an effort to learn. > Your .aspic templates make a great example for the more experienced > programmer but may be a bit overwhelming for the person just learning > how to do relocatable coding. I agree. They are not meant as introductory material, but I think the concepts in them should be taught early on before bad habits to the contrary are developed. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics