As a test I have
Code: Select all
ISR INT0()
putpin loopTogglePin, zxOutputToggle
end ISR
Anyone have thoughts on what's going on?
[EDIT: 1280n]
Code: Select all
ISR INT0()
putpin loopTogglePin, zxOutputToggle
end ISR
It could be caused by using an older version of the ZBasic compiler. You need v2.5.0 or later.pjc30943 wrote: recieve a simple "Internal Error: an error occurred while building test.zxb", exit code 1.
Code: Select all
Biped_Main_2legs.c: In function 'zf_Main':
Biped_Main_2legs.c:46: warning: cast from pointer to integer of different size
Biped_Main_2legs.c:48: warning: cast from pointer to integer of different size
Biped_Main_2legs.c:50: warning: cast from pointer to integer of different size
Biped_Main_2legs.c:52: warning: cast from pointer to integer of different size
Biped_Main_2legs.c:54: warning: cast from pointer to integer of different size
Biped_Main_2legs.c:57: warning: cast from pointer to integer of different size
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct Biped_header_2legs.c -o Biped_header_2legs.o
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct Biped_IO_routines_2legs.c -o Biped_IO_routines_2legs.o
Biped_IO_routines_2legs.c: In function 'zf_putDACs':
Biped_IO_routines_2legs.c:33: warning: passing argument 3 of 'cmdSPI' from incompatible pointer type
Biped_IO_routines_2legs.c: In function 'zf_encoderTask':
Biped_IO_routines_2legs.c:51: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:74: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:98: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:100: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:124: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:126: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:150: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:152: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:177: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:179: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:203: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:205: warning: cast from pointer to integer of different size
Biped_IO_routines_2legs.c:246: warning: cast from pointer to integer of different size
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct biped_joint_controllers_2legs.c -o biped_joint_controllers_2legs.o
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct biped_user_IO_2legs.c -o biped_user_IO_2legs.o
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct Biped_Test_Routines_2legs.c -o Biped_Test_Routines_2legs.o
Biped_Test_Routines_2legs.c: In function 'zf_monitorEncoders':
Biped_Test_Routines_2legs.c:8: warning: cast from pointer to integer of different size
Biped_Test_Routines_2legs.c:9: warning: cast from pointer to integer of different size
Biped_Test_Routines_2legs.c:11: warning: cast from pointer to integer of different size
Biped_Test_Routines_2legs.c:12: warning: cast from pointer to integer of different size
Biped_Test_Routines_2legs.c:14: warning: cast from pointer to integer of different size
Biped_Test_Routines_2legs.c:15: warning: cast from pointer to integer of different size
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct biped_utils_2legs.c -o biped_utils_2legs.o
biped_utils_2legs.c: In function 'zf_initCPU':
biped_utils_2legs.c:106: warning: cast from pointer to integer of different size
biped_utils_2legs.c:107: warning: cast from pointer to integer of different size
biped_utils_2legs.c:111: warning: cast from pointer to integer of different size
biped_utils_2legs.c:112: warning: cast from pointer to integer of different size
biped_utils_2legs.c:116: warning: cast from pointer to integer of different size
biped_utils_2legs.c:117: warning: cast from pointer to integer of different size
biped_utils_2legs.c:121: warning: cast from pointer to integer of different size
biped_utils_2legs.c:122: warning: cast from pointer to integer of different size
biped_utils_2legs.c:126: warning: cast from pointer to integer of different size
biped_utils_2legs.c:127: warning: cast from pointer to integer of different size
biped_utils_2legs.c:131: warning: cast from pointer to integer of different size
biped_utils_2legs.c:132: warning: cast from pointer to integer of different size
biped_utils_2legs.c:136: warning: cast from pointer to integer of different size
biped_utils_2legs.c:137: warning: cast from pointer to integer of different size
biped_utils_2legs.c:141: warning: cast from pointer to integer of different size
biped_utils_2legs.c:142: warning: cast from pointer to integer of different size
biped_utils_2legs.c:146: warning: cast from pointer to integer of different size
biped_utils_2legs.c:147: warning: cast from pointer to integer of different size
biped_utils_2legs.c:151: warning: cast from pointer to integer of different size
biped_utils_2legs.c:152: warning: cast from pointer to integer of different size
biped_utils_2legs.c:156: warning: cast from pointer to integer of different size
biped_utils_2legs.c:157: warning: cast from pointer to integer of different size
biped_utils_2legs.c:161: warning: cast from pointer to integer of different size
biped_utils_2legs.c:162: warning: cast from pointer to integer of different size
biped_utils_2legs.c:166: warning: cast from pointer to integer of different size
biped_utils_2legs.c:167: warning: cast from pointer to integer of different size
biped_utils_2legs.c:171: warning: cast from pointer to integer of different size
biped_utils_2legs.c:172: warning: cast from pointer to integer of different size
biped_utils_2legs.c:176: warning: cast from pointer to integer of different size
biped_utils_2legs.c:177: warning: cast from pointer to integer of different size
biped_utils_2legs.c:181: warning: cast from pointer to integer of different size
biped_utils_2legs.c:182: warning: cast from pointer to integer of different size
biped_utils_2legs.c:186: warning: cast from pointer to integer of different size
biped_utils_2legs.c:187: warning: cast from pointer to integer of different size
biped_utils_2legs.c:191: warning: cast from pointer to integer of different size
biped_utils_2legs.c:192: warning: cast from pointer to integer of different size
biped_utils_2legs.c:196: warning: cast from pointer to integer of different size
biped_utils_2legs.c:197: warning: cast from pointer to integer of different size
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct biped_obsolete_functions_2legs.c -o biped_obsolete_functions_2legs.o
avr-gcc -o biped_2legs.i1 -mmcu=atmega1280 -L"C:/Program Files/ZBasic/zxlib" -Wl,-T,"C:/Program Files/ZBasic/zxlib/zx_avr5.lds" -u rtc_ISR -u int0_ISR -u int1_ISR -u int2_ISR -u int3_ISR -u int4_ISR -u int5_ISR -u int6_ISR -u int7_ISR -u pcint0_ISR -u pcint1_ISR -u pcint2_ISR -u anaComp_ISR Biped_Main_2legs.o Biped_header_2legs.o Biped_IO_routines_2legs.o biped_joint_controllers_2legs.o biped_user_IO_2legs.o Biped_Test_Routines_2legs.o biped_utils_2legs.o biped_obsolete_functions_2legs.o -lzx1280n -lm
C:/Program Files/ZBasic/zxlib\libzx1280n.a(int0_ISR.o): In function `__vector_1':
(.text+0x0): multiple definition of `__vector_1'
Biped_IO_routines_2legs.o:C:\Program Files\ZBasic\zx_XfhlAB/Biped_IO_routines_2legs.c:37: first defined here
make: *** [biped_2legs.i1] Error 1
make: Leaving directory `C:/Program Files/ZBasic/zx_XfhlAB'
Biped Test Routines 2legs.bas:506: Warning(8): subroutine will never return
biped utils 2legs.bas:184: Warning(8): subroutine will never return
Internal Error: an error occurred while building biped 2legs.zxb
>Exit code: 1
The presence of all of the warnings causes me some concern. That may be indicative of a separate issue that needs to be explored.pjc30943 wrote:Verbose flag added. The entire result is posted below
Code: Select all
C:/Program Files/ZBasic/zxlib\libzx1280n.a(int0_ISR.o): In function `__vector_1':
(.text+0x0): multiple definition of `__vector_1'
Biped_IO_routines_2legs.o:C:\Program Files\ZBasic\zx_XfhlAB/Biped_IO_routines_2legs.c:37: first defined here
Code: Select all
waitforinterrupt zxPinRisingEdge, WaitInt6
Indeed. There was a logic error in the compiler code that ended up including all of the ISRs related to WaitForInterrupt() even though it could tell that only INT6 was needed.pjc30943 wrote:Odd that the compiler can't determine that this uses INT6.
Are the warnings gone as well?pjc30943 wrote:That fixed the error message.
No, it is not. When you define an ISR, all that happens is that the ISR code you provide is included in the downloadable image and the vector for that interrupt points to the ISR. (For each interrupt, unless an ISR is provided, either by you or automatically by the ZBasic compiler, the vector points to a default ISR that causes a reset.) If you do provide an ISR, you also have to supply code that configures the related I/O registers as you want them in order to cause the interrupt to occur.pjc30943 wrote:s it the case that by defining the ISR routine, as coded above, interrupts of that type are automatically enabled?
It sounds like the documentation could be made more clear. Reference, please?pjc30943 wrote:This is, from the documentation, no initialization (by the user) is required, but is taken care of during compilation.
The warnings remain. I'm not sure which are legitimate (aside from the normal VM-type warnings of statements not being executed, etc)dkinzer wrote:Are the warnings gone as well?
dkinzer wrote:No, it is not. When you define an ISR, all that happens is that the ISR code you provide is included in the downloadable image and the vector for that interrupt points to the ISR...
The documentation is fine, and was not at fault...dkinzer wrote:Reference, please?
They're all legitimate but only one is due to the way that you wrote your code. The warnings like the two below should have been eliminated by the changes in zxlib.h.pjc30943 wrote:The warnings remain. I'm not sure which are legitimate (aside from the normal VM-type warnings of statements not being executed, etc)
Code: Select all
warning: cast from pointer to integer of different size
warning: passing argument 3 of 'cmdSPI' from incompatible pointer
The DisableInt()/EnableInt() calls deal with globally disabling/enabling interrupts. This allows sequences of code to execute without being interrupted by anything. Even when interrupts are globally enabled, the individual interrupts (e.g. USART receive, timer overflow, pin change interrupt, etc.) need to be configured and separately enabled. Some of the interrupts (e.g. external interrupts) have several different modes of operation. The compiler has no way, of course, of knowing how you might want a particular interrupt configured or when you might want it enabled.pjc30943 wrote:the section for EnableInt()
Okay, thanks.When I compile your code here I get just one warning about a routine never returning. If you wish, you can suppress this warning using the #pragma warning construct.
It is the new version, but the warnings still abound. I'll recopy the file and check again.Check the timestamp of the file {ZBasic install directory}/zxlib/zxlib.h - it should have today's date. If not, copy the one from the .zip file referenced above over it.
Code: Select all
>"C:\Program Files\ZBasic\zbasic.exe" --target-device=ZX1281e --directory="C:\Program Files\ZBasic/" --project="biped 2legs.pjt"
make: Entering directory `C:/Program Files/ZBasic/zx_uech6N'
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct Biped_Main_2legs.c -o Biped_Main_2legs.o
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct Biped_header_2legs.c -o Biped_header_2legs.o
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct Biped_IO_routines_2legs.c -o Biped_IO_routines_2legs.o
Biped_IO_routines_2legs.c: In function '__vector_3':
Biped_IO_routines_2legs.c:333: warning: 'zv_timerEnd' may be used uninitialized in this function
Biped_IO_routines_2legs.c:332: warning: 'zv_timerStart' may be used uninitialized in this function
Biped_IO_routines_2legs.c: In function '__vector_2':
Biped_IO_routines_2legs.c:316: warning: 'zv_timerEnd' may be used uninitialized in this function
Biped_IO_routines_2legs.c:315: warning: 'zv_timerStart' may be used uninitialized in this function
Biped_IO_routines_2legs.c: In function '__vector_1':
Biped_IO_routines_2legs.c:299: warning: 'zv_timerEnd' may be used uninitialized in this function
Biped_IO_routines_2legs.c:298: warning: 'zv_timerStart' may be used uninitialized in this function
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct biped_joint_controllers_2legs.c -o biped_joint_controllers_2legs.o
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct biped_user_IO_2legs.c -o biped_user_IO_2legs.o
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct Biped_Test_Routines_2legs.c -o Biped_Test_Routines_2legs.o
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct biped_utils_2legs.c -o biped_utils_2legs.o
avr-gcc -c -Dzx1280n -mmcu=atmega1280 -std=gnu99 -fgnu89-inline -gdwarf-2 -Os -I"C:/Program Files/ZBasic/zxlib" -I. -Wall -Wstrict-prototypes -funsigned-char -fpack-struct biped_obsolete_functions_2legs.c -o biped_obsolete_functions_2legs.o
avr-gcc -o biped_2legs.i1 -mmcu=atmega1280 -L"C:/Program Files/ZBasic/zxlib" -Wl,-T,"C:/Program Files/ZBasic/zxlib/zx_avr5.lds" -u rtc_ISR -u int1_ISR -u int2_ISR -u int3_ISR Biped_Main_2legs.o Biped_header_2legs.o Biped_IO_routines_2legs.o biped_joint_controllers_2legs.o biped_user_IO_2legs.o Biped_Test_Routines_2legs.o biped_utils_2legs.o biped_obsolete_functions_2legs.o -lzx1280n -lm
C:/Program Files/ZBasic/zxlib\libzx1280n.a(int1_ISR.o): In function `__vector_2':
(.text+0x0): multiple definition of `__vector_2'
Biped_IO_routines_2legs.o:C:\Program Files\ZBasic\zx_uech6N/Biped_IO_routines_2legs.c:314: first defined here
C:/Program Files/ZBasic/zxlib\libzx1280n.a(int2_ISR.o): In function `__vector_3':
(.text+0x0): multiple definition of `__vector_3'
Biped_IO_routines_2legs.o:C:\Program Files\ZBasic\zx_uech6N/Biped_IO_routines_2legs.c:331: first defined here
make: *** [biped_2legs.i1] Error 1
make: Leaving directory `C:/Program Files/ZBasic/zx_uech6N'
Biped Test Routines 2legs.bas:63: Warning(8): subroutine will never return
biped utils 2legs.bas:187: Warning(8): subroutine will never return
Internal Error: an error occurred while building biped 2legs.zxb
>Exit code: 1