Used and free rom

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

Used and free rom

#1 Post by arco » 18 Jul 2017 13:59

If I use the ORGALL directive, it doesn't reflect in the compiler results.
Regardless of the ORGALL address, the Free/Used rom count doesn't change.
(so Used rom is too low, and free rom is too high...)

If you add a few instructions, you suddenly go from '45% free rom' to 'not enough rom'...
(all memory beneath the ORGALL address should be marked as used)
Regards,

Peter.

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Used and free rom

#2 Post by lana.arsic » 19 Jul 2017 17:29

Hi Peter,
arco wrote:If I use the ORGALL directive, it doesn't reflect in the compiler results.
Regardless of the ORGALL address, the Free/Used rom count doesn't change.
(so Used rom is too low, and free rom is too high...)
Directive orgall should not influence on Used/Free ROM,
you only set place where routines, constants, etc will be stored in ROM, not used size.
arco wrote: If you add a few instructions, you suddenly go from '45% free rom' to 'not enough rom'...
(all memory beneath the ORGALL address should be marked as used)
Can you tell me which MCU are you using
and from which address did you try ?

Kind regards,
Lana

arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

Re: Used and free rom

#3 Post by arco » 19 Jul 2017 18:50

I use a 24fj256ga108. Used rom(bytes): xxxx should change if you change the orgall value
If you add 0x1000 to the orgall address, used rom should go up with the same amount.
Directive orgall should not influence on Used/Free ROM,
you only set place where routines, constants, etc will be stored in ROM, not used size.
That's not completely true. The Orgall directive sets the low threshold for rom use.
So effectively all rom beneath Orgall address is unusable and should be set as used.
(it's not available for code anymore)

Also a question: Why is orgall 0x400 not allowed?
(with everything below 0x600 I get: "Bad absolute address, invalid Orgall address")
AFAIK only 0x000 to 0x1FF is reserved for the vector tables?
Regards,

Peter.

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Used and free rom

#4 Post by lana.arsic » 20 Jul 2017 16:42

Hi Peter,

I'm sorry, I couldn't reproduce the same behavior with
code which I have tried, can you please post code where issue is demonstrated?

Kind regards,
Lana

arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

Re: Used and free rom

#5 Post by arco » 20 Jul 2017 16:57

Any code with an 'orgall' will do.
If you change orgall from 0x1000 to 0x2000 then the compile results should also give 0x1000 more for used rom, but it doesn't change.
(as said, all rom beneath orgall is unusable for code so should be set as used)
Regards,

Peter.

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Used and free rom

#6 Post by lana.arsic » 21 Jul 2017 15:11

Hi Peter,

I'm sorry for misunderstanding,
I have asked for code where you are getting error:
"Bad absolute address, invalid Orgall address", since I couldn't reproduce it.

Regarding used ROM, now I have also consulted with our developer
orgall shouldn't change Used ROM.

Orgall place whole code starting from specified address,
and in Used ROM is counted only used code.

Kind regards,
Lana

arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

Re: Used and free rom

#7 Post by arco » 21 Jul 2017 15:17

Well,

If is is intended, it certainly isn't useful... :)
Now after every compile I have to get my calculator to see how much rom is really left...
(I have to add the orgall value to it)

Simple example code for a 24FJ256GA108 showing the unlogical behaviour.

This code compiles with result: free rom(bytes):174566(100%)

Code: Select all

program Test

main:
  orgall (0x2abe6)
  while TRUE
  wend
end.
Adding a single NOP compile fails with: "there is not enough rom space"

Code: Select all

program Test

main:
  orgall (0x2abe6)
  while TRUE
    nop
  wend
end.
Regards,

Peter.

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Used and free rom

#8 Post by lana.arsic » 25 Jul 2017 17:23

Hi Peter,

I have also consulted with our developer, you are getting the error,
because you have reached the end of the flash,
you can take a look in mlk file (Ctrl + Alt + D) max address is 0x2abf7.

When you set address on 0x2abf4 it will compile, but you can check .lst file,
in that case the last used address is 0x2abf6.

Kind regards,
Lana

arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

Re: Used and free rom

#9 Post by arco » 25 Jul 2017 17:48

Thanks,

I know what the cause is and how to solve it, but that's not the point here.
Point is that the free rom count becomes useless if you use OrgAll, very annoying.
Regards,

Peter.

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Used and free rom

#10 Post by lana.arsic » 26 Jul 2017 09:27

Hi Peter,

I'm sorry if that annoys you for this particular case,
but one of the use of orgall directive and used/free ROM
can be seen in Bootloader example, which is located in installation folder of the compiler.

Orgall is used to place bootloader firmware at specific address,
and free ROM can be used for another code.

Kind regards,
Lana

arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

Re: Used and free rom

#11 Post by arco » 26 Jul 2017 10:16

I see I can't convince you... :)
Bootloader and user application are 2 separate programs that have nothing to do with each other.
(except for living together in the same microcontroller)
So used rom is different for both.
Regards,

Peter.

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Used and free rom

#12 Post by lana.arsic » 27 Jul 2017 17:11

Hi Peter,

I agree that bootloader and that user application are two separated programs,
but I gave one example, I'm sorry if you don't find it useful.

Kind regards,
Lana

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”