PropBasic Bug?
FriedV
Posts: 77
Trying to compile:
HomeSpun To RAM
Homespun Spin Compiler 0.31d
parsing C:\Work\Propeller\PropBasic\Programs\Test_SPI_Task_LIB.spin
parsing C:\Work\Propeller\PropBasic\Programs\SPI_Task.spin
compiling Test_SPI_Task_LIB.spin
Error: C:\Work\Propeller\PropBasic\Programs\Test_SPI_Task_LIB.spin (119, 46): Unknown symbol VP_Watch
SPI_Task_COG:=SPI_Task.Init(@__DataStart, @VP_Watch)
^
Is this a bug?
Kind regards, Friedrich
' ---------------------------------------------------------------------- ' File...... Std.lib ' Author.... fgvissel 10.10.2011 ' Library Std, Delay Subs & idx vars ' ====================================================================== ' ----- External Libs -------------------------------------------------- ' ----- Conditional Compilation Symbols -------------------------------- ' ----- Constants ------------------------------------------------------ ' ----- IO Pins -------------------------------------------------------- ' ----- Shared (HUB) Variables (Byte, Word, Long) ---------------------- ' ----- User Data (DATA, WDATA, LDATA, FILE) --------------------------- ' ----- TASK Definitions ----------------------------------------------- ' ----- Local Variables (LONG only) ------------------------------------ error var long = 0 'for error signaling, 0 = no error tmp1 var long 'those are temp vars for temporary use tmp2 var long 'mind they are global tmp3 var long tmp4 var long tmp5 var long ' tmp6 var long 'more when needed ' tmp7 var long ' tmp8 var long ' tmp9 var long ' ----- SUB and FUNC Definitions --------------------------------------- DelayMS SUB 1 DelayUS SUB 1 '{$CODE} ' ----- SUB and FUNC Code ---------------------------------------------- SUB DelayMS pause __param1 ENDSUB SUB DelayUS pauseus __param1 ENDSUB '=======================================================================and
' ---------------------------------------------------------------------- ' File...... Test_SPI_Task.pbas ' Author.... fgvissel 12.10.2011 ' ====================================================================== ' ----- Device Settings ------------------------------------------------ DEVICE P8X32A, XTAL1, PLL16X XIN 6_250_000 ' ----- External Libs -------------------------------------------------- '{$ifndef StdLib} '{$define StdLib} LOAD "C:\work\propeller\propbasic\library\Std.Lib" '{$endif} ' ----- Conditional Compilation Symbols -------------------------------- ' ----- Constants ------------------------------------------------------ Dog_Init CON 10 Dog_OutChar CON 11 Dog_OutString CON 12 Dog_Clear CON 13 Dog_Line1 CON 14 Dog_Line2 CON 15 Dog_Line3 CON 16 Dog_ClearLine1 CON 17 Dog_ClearLine2 CON 18 Dog_ClearLine3 CON 19 Dog_Set CON 20 ' ----- IO Pins -------------------------------------------------------- ERR_LED Pin 1 low OK_LED Pin 0 low ' ----- Shared (HUB) Variables (Byte, Word, Long) ---------------------- Cmd hub long = 0 'for command handler ' ----- User Data (DATA, WDATA, LDATA, FILE) --------------------------- ' ----- TASK Definitions ----------------------------------------------- SPI_Task TASK ' ----- Local Variables (LONG only) ------------------------------------ SPI_Cog var long ' ----- SUB and FUNC Definitions --------------------------------------- ' ====================================================================== PROGRAM Start Start: cogstart SPI_Task, SPI_Cog if SPI_Cog = 8 then error = 1 endif Main: '###### The End ######################################################## tmp1 = _FREQ /10 'the loop of life .... tmp2 = cnt + tmp1 If error <> 0 then 'finish with error do toggle ERR_LED waitcnt tmp2, tmp1 loop else 'finish ok do toggle OK_LED waitcnt tmp2, tmp1 loop endif '##################################################################### END ' ----- SUB and FUNC Code ---------------------------------------------- ' ----- TASK Code ------------------------------------------------------ TASK SPI_Task 'handles SPI commands for DogM163 and uM-FPU ' ~~~~~ External Libs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LOAD "C:\work\propeller\propbasic\library\Std.Lib" ' ~~~~~ Conditional Compilation Symbols ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' ~~~~~ Constants ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' ~~~~~ IO Pins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TASKLED pin 7 low ' ~~~~~ Shared (HUB) Variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' ~~~~~ User Data (DATA, WDATA, LDATA, FILE) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' ~~~~~ Local Variables (LONG only) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' ~~~~~ SUB and FUNC Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' ~~~~~ Task Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tmp1 = _FREQ /5 'slow blink forever tmp2 = cnt + tmp1 do toggle TASKLED waitcnt tmp2, tmp1 loop ' ~~~~~ Task SUBs and FUNCs Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENDTASK ' ----------------------------------------------------------------------PropBasic compiles OK, Spin doesn't:
HomeSpun To RAM
Homespun Spin Compiler 0.31d
parsing C:\Work\Propeller\PropBasic\Programs\Test_SPI_Task_LIB.spin
parsing C:\Work\Propeller\PropBasic\Programs\SPI_Task.spin
compiling Test_SPI_Task_LIB.spin
Error: C:\Work\Propeller\PropBasic\Programs\Test_SPI_Task_LIB.spin (119, 46): Unknown symbol VP_Watch
SPI_Task_COG:=SPI_Task.Init(@__DataStart, @VP_Watch)
^
Is this a bug?
Kind regards, Friedrich
Comments
Yes that is a bug.
Here is a corrected version of the compiler (version 1.25).
Bean
could you please also have a look at PropBasic & Libraries.
I don't know if I can build programs this way, it is a bit "C"-style.
Fried
I never intended LOAD to be nested. It's not going to work. It will probably stop after 1 level and never return to continue compiling the main program.
Bean
thank you sir!
edit: looks like i get the same error with v1.24 as well...last version i have that worked is 1.19, but i havent tried anything in between.
error:
Bean
A task cannot start another task. The addresses of the tasks are held in the main program's COG RAM, so it is not readable from other tasks.
I could store it in HUB ram, but that will take some work to shuffle everything around.
I'll put it on the list of things to fix.
Bean