Hello, everybody!
I trying to port russian RTOS OSA (http://wiki.pic24.ru/doku.php/en/osa/ref/intro or http://picosa.narod.ru) under mikroC compiler for PIC16-controllers.
There is one general problem: I can't get current program counter value. Library function setjmp() does not work correctly: it just reads register pair PCLATH:PCL, but PCLATH can contain any value, but not high byte of program counter. Thus this function return incoorect value of program counter.
I tried to get PC using inline assembler. There is an operator "$" (by linker "$" is substituted by current ROM address), but using "$" is possible only with call and goto instuctions. I need to use it with movlw, but compiller tells me: "Message No. 0: $: const not found"
Does anybody know any other way to get current program counter?
Thank you!
Victor Timofeev.
P.S. RTOS OSA is freeware and all source code included. I know that many people interested in RTOS under mikroC and asked about it, but there is no any. So I think all you will be interested in free RTOS for microC compiller. Soon all documentation will be translated in english.
Porting RTOS for microC
-
- Posts: 32
- Joined: 27 Sep 2008 22:39
- Location: Russia, SPb
- Contact:
Porting RTOS for microC
Last edited by testerplus on 21 Dec 2008 16:52, edited 1 time in total.
-
- Posts: 32
- Joined: 27 Sep 2008 22:39
- Location: Russia, SPb
- Contact:
Hi Testerpluss,
did you ever find a way to do this?
I too spotted this problem - for PIC16 setjmp can not work (I guess it wprks for the 'examples' as these ensure PCLH will be zero as they are simple demos !!!)
I am not using setjmp but writing a workround macro to overcome stack limitations where RAM is available.
All I need is to be able to access the current PC value from the linker e.g. MOVLW #$ or similar (even LBL: MOVLW #LBL would do!!!)
Please help us ME team
Jeff
did you ever find a way to do this?
I too spotted this problem - for PIC16 setjmp can not work (I guess it wprks for the 'examples' as these ensure PCLH will be zero as they are simple demos !!!)
I am not using setjmp but writing a workround macro to overcome stack limitations where RAM is available.
All I need is to be able to access the current PC value from the linker e.g. MOVLW #$ or similar (even LBL: MOVLW #LBL would do!!!)
Please help us ME team
Jeff
-
- Posts: 32
- Joined: 27 Sep 2008 22:39
- Location: Russia, SPb
- Contact:
No, I didn't. I understood that there is no way to get current PC value for PIC10, 12, 16. I have only one idea: to write an utilite, that will modify HEX-file. But in this case it will be unable to debug program.Dr Jeff wrote:Hi Testerpluss,
did you ever find a way to do this?
Both methods: "movlw #$" and "LBL: movlw #LBL") will not work (compiler exits with an error)Dr Jeff wrote: All I need is to be able to access the current PC value from the linker e.g. MOVLW #$ or similar (even LBL: MOVLW #LBL would do!!!)
Testerplus.
PIC18 MikroC version
What did you end up having to do to get a MikroC version to compile?
Thanks
Thanks
-
- Posts: 32
- Joined: 27 Sep 2008 22:39
- Location: Russia, SPb
- Contact:
Re: PIC18 MikroC version
I need some free time.kangus wrote:What did you end up having to do to get a MikroC version to compile?
Thanks
Besides, there are too little people who interested in RTOS for mikroC.
-
- Posts: 32
- Joined: 27 Sep 2008 22:39
- Location: Russia, SPb
- Contact:
Re: PIC18 MikroC version
I tried to test new mikroC PRO (http://www.mikroe.com/forum/viewtopic.php?t=18620). I am glad that in-line assembler construction:
now works for PIC16!
Later I'll check simulator with PUSH, POP, RETURN ect instructions for PIC18 (they did not work in 8.2).
Code: Select all
movlw $
Later I'll check simulator with PUSH, POP, RETURN ect instructions for PIC18 (they did not work in 8.2).
Last edited by testerplus on 05 Mar 2009 17:49, edited 1 time in total.
-
- Posts: 32
- Joined: 27 Sep 2008 22:39
- Location: Russia, SPb
- Contact:
Re: PIC18 MikroC version
Just checked: all works correctly!testerplus wrote:Later I'll check simulator with PUSH, POP, RETURN ect instructions for PIC18 (they did not work in 8.2).