Is it possible to split low level routines files for AVR and PIC. I think that this will help to improve development for both platforms. More easy to read and edit these files. Compiler will work more quickly because it is not necessary to make additional check in #ifdef and no necessary to compile code for AVR and PIC at the same time.Drawbacks: more files in include directory.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did think about splitting the low level include files when first adding AVR support, and came to the conclusion it would be easier to leave all related subroutines in a single file.
The main reason for not splitting the files is that there would be quite a bit of duplication - if you look at system.h, you'll see that some routines (from memory, division and 16-bit multiply) are the same for both, while others (string copy) vary even between chips from the same company. Splitting the files would mean having 2 identical copies of the routines, which would make it easy to fix a bug in one copy while forgetting about the other. Keeping things in the same file also helps with synchronisation - it's easier to see if a particular routine is only implemented on one chip type and needs to be adapted.
In the case of some routines (such as A/D) there is admittedly nothing in common, but these already include quite a lot of #ifdefs for different PICs, so a few more for AVR aren't going to make a lot of difference. LCD, RS232, PS/2 and a few other routines are identical between the two chips.
There would be some improvement in compilation time from having split files, but I doubt it would be noticeable. GCBASIC spends far longer doing other things (replacing constants and allocating memory to subroutines on PIC12F/16Fs are 2 time consuming tasks that come to mind).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello there!
Is it possible to split low level routines files for AVR and PIC. I think that this will help to improve development for both platforms. More easy to read and edit these files. Compiler will work more quickly because it is not necessary to make additional check in #ifdef and no necessary to compile code for AVR and PIC at the same time.Drawbacks: more files in include directory.
I did think about splitting the low level include files when first adding AVR support, and came to the conclusion it would be easier to leave all related subroutines in a single file.
The main reason for not splitting the files is that there would be quite a bit of duplication - if you look at system.h, you'll see that some routines (from memory, division and 16-bit multiply) are the same for both, while others (string copy) vary even between chips from the same company. Splitting the files would mean having 2 identical copies of the routines, which would make it easy to fix a bug in one copy while forgetting about the other. Keeping things in the same file also helps with synchronisation - it's easier to see if a particular routine is only implemented on one chip type and needs to be adapted.
In the case of some routines (such as A/D) there is admittedly nothing in common, but these already include quite a lot of #ifdefs for different PICs, so a few more for AVR aren't going to make a lot of difference. LCD, RS232, PS/2 and a few other routines are identical between the two chips.
There would be some improvement in compilation time from having split files, but I doubt it would be noticeable. GCBASIC spends far longer doing other things (replacing constants and allocating memory to subroutines on PIC12F/16Fs are 2 time consuming tasks that come to mind).