Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 20, 2024, 09:18:07 09:18


Login with username, password and session length


Pages: [1]
Print
Author Topic: XC8 - MikroC / pragma udata  (Read 5472 times)
0 Members and 1 Guest are viewing this topic.
Elysion
Newbie
*
Offline Offline

Posts: 14

Thank You
-Given: 27
-Receive: 1


« on: March 08, 2015, 03:40:38 15:40 »

Hi,

Is there any similar functionality like #pragma udata - (XC8) in mikroC? I don't want to address every register with absolute addressing.

Thanks,
Oguz
Logged
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #1 on: March 08, 2015, 04:18:32 16:18 »

Hi,
I am not sure if I understood what you really want; in mikroC if you want to set an absolute address for a variable you need to use absolute directive :
Code:
short x absolute 0x22;
// Variable x will occupy 1 byte at address 0x22
int y absolute 0x23;
// Variable y will occupy 2 bytes at addresses 0x23 and 0x24

Usually you will let linker to assign addresses and align variables from optimization reasons, even more in a PIC controller where the RAM is split in banks
Logged
Elysion
Newbie
*
Offline Offline

Posts: 14

Thank You
-Given: 27
-Receive: 1


« Reply #2 on: March 26, 2015, 03:25:28 15:25 »

Hi,

I have a lot of inline assembly in my code due to time critical issues and I don't want to change banks forward/backward due to variable locations.
So I have 40+ variables needed to be in one bank. There are structures, custom types for these variables. Calculating size/address for each to write to each absolute parameter  is very time consuming. "pragma udata" type directive is the exact needed one.

Thanks,
Oguz
Logged
h0nk
Senior Member
****
Offline Offline

Posts: 256

Thank You
-Given: 208
-Receive: 230



« Reply #3 on: March 26, 2015, 05:36:14 17:36 »

Hello Elysion,

i am running V1.31 of XC8.
But using:

#pragma udata blub

gives:
unknown pragma "udata"

Absolute addressing in XC8 is done with "@", as in:
char c @ 0x34;
In XC8 You should also be able to put Your common variables in a psect which You can define.

I do not use MicroC anymore, so i am sorry not able to help You with Your question.
But MicroC is missing a dedicated linker, so i am afraid there are no precautions to put variables together.

But: What should this pragma doing?


Best Regards
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC