Hi Vasi,
Thanks.
In the meantime I solved the mystery about the warning that whereis() cannot be applied on a constant also in case of a constant array. So if you - or other JAL users - are interested you can read the following.
I was trying to get DMA on a PIC operational, just to see how it works. I declared a const array with some text that I wanted to send to the USART using DMA. For DMA you need the address of the constant array so I used the whereis() function for that but got
the message that whereis() cannot be used on a constant. This is true for a single constant as described in the jalv2 documentation but I found that strange for a constant array since that is not a single constant.
The problem was caused by the following. Since DMA only uses the address of the constant array and not the constant array itself, the compiler 'thinks' that the constant array is not used and so it is optimized away and then the whereis() function cannot find
the label of the constant array and so generates the error message. I made a DMA sample program (18f15q40_dma.jal) and solved this by a dummy instruction that uses the const array and then it works. This dummy code looks like this but can be any other code
as long as you make the compiler 'think' that the array is used: dummy = dummy + my_text_with_dma[text_size] where
my_text_with_dma is the constant array.
So I think it should have been nice that if you use the whereis() on a constant array that it flags it as being used so that it is not optimized away. But anyway it now works and I added to the jalv2 documentation the following about a simple constant which
was already documented: A simple constant or an unused constant array will generate an error.
I assume - but did not test this - that the same error message is given if you apply it to a procedure when the procedure is not used. Not sure if there is a use case for this but I can imagine that this could be the case if you would like to pass an address
of a procedure as argument to another procedure that then calls that procedure using its address (you need to hack some assembly code to get that working I think) in which case the procedure iteself is not called directly.
Kind regards,
Rob