Unexplainable compiler issue

11 views
Skip to first unread message

rob...@hotmail.com

unread,
Sep 5, 2025, 11:28:44 AM (4 days ago) Sep 5
to jallib
Hi all,

I have a very strange problem. I made sample programs for the ina3221 library and they all work well.

Now I want to make a special test program for a video so I re-used some code from the sample program but now the compiler generates an assert. It happens when I call the init routine of the ina3221 library but there is not much code in there. Even if I almost completely remove all code from the sample program I get this compiler error.

jal jalv25r9 (compiled Jan 12 2025)
generating p-code
3364 tokens, 192031 chars; 4350 lines; 5 files
generating PIC code pass 1
Assertion failed!
Program: c:\jallib\compiler\jalv2_64.exe      
File: pic_op.c, Line 4470
Expression: !pic_value_is_w(dst)

And the program is only this:
-- Define the IIC pins and initiaize the pin direction.
alias i2c_scl is pin_C0 -- Pin 10 for 14 pin DIP
-- alias pin_scl_direction is pin_C0_direction. Note: Not needed for this PIC.
alias i2c_sda is pin_C1 -- Pin 9 for 14 pin DIP.
-- alias pin_sda_direction is pin_C1_direction. Note: Not needed for this PIC.
const word _i2c_bus_speed = 4 -- 400 kHz.
const bit  _i2c_level = TRUE  -- i2c levels (not SMB)
const word I2C_HARDWARE_TIMEOUT = 10_000 -- At least 10 ms to prevent hang-up.
include i2c_hardware  
i2c_initialize()

-- Now include the ina3221 library and initialize.
-- Remove the comment below if you want to use floats instead of word/dword.
--const INA3221_USE_FLOAT = TRUE
include ina3221
ina3221_init()



Any suggestions?

Thanks.

Kind regards,

Rob

vsurducan

unread,
Sep 5, 2025, 2:31:24 PM (4 days ago) Sep 5
to jal...@googlegroups.com
Hi Rob, if you remove the library I presume the error will dissapear. 
Can you isolate the initalisation in the library, take it out from the library and move it in the sample? Then without any library include see if the error still appears?

--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jallib/629164e4-307c-4def-a2fc-42fd894b2fe9n%40googlegroups.com.

Rob CJ

unread,
Sep 6, 2025, 5:09:22 AM (3 days ago) Sep 6
to jal...@googlegroups.com
Hi Vasile,

I tried that and tried several other things. Thanks for the suggestion.

It must be a compiler issue since I have a working sample program for the ina3221 library and if I remove everything from this working program after the init (so remove the  main program), the assert happens. 

Normally I would reduce the program to the minium to reproduce the issue but since I need to include the ina3221 library that is not that easy.

I leave it for now but if somebody runs into this issue let me know.

And for Bill. I did some small corrections in the ina3221 library but it the impact is minimal. For negative values that uses two complement, you just apply the same two complement for the reverse action. I did it a bit differently (and with some overhead). Will upload it to Jallib today including an updated sample program that shows the use of alerts.

Kind regards,

Rob


Van: jal...@googlegroups.com <jal...@googlegroups.com> namens vsurducan <vsur...@gmail.com>
Verzonden: vrijdag 5 september 2025 20:31
Aan: jal...@googlegroups.com <jal...@googlegroups.com>
Onderwerp: Re: [jallib] Unexplainable compiler issue
 
Reply all
Reply to author
Forward
0 new messages