Author Topic: Code size for a 8051 processor  (Read 1782 times)

Offline orbanp

  • Single posting newcomer
  • *
  • Posts: 2
Code size for a 8051 processor
« on: November 27, 2020, 08:26:42 pm »
Hello Everyone,

New here, and new with Code Blocks, so please bear with me.

Eventually I would like to program in C the AT89S52 processor, that is a derivative of the 8051 processor.
Having looked at and starting a 8051 project in C::B, one of the questions at setting up the project was the maximum size of the code.
I imagine that meant the available code space in the target processor.
I left it at 64kb thinking that I would change it later.
Unfortunately I do not see or find any ways of changing that property of the project!
Is there really no way of changing that?
Do I need to delete the project and recreate it?
No big loss at this time, I am just playing with and learning the system.
The "Help" facility was not much of a help there...

Ultimately, I would like to import a project from the "MCU 8051 IDE" environment from Moravia Microsystems that I used before.
Unfortunately that system is not supported actively any longer.
Any comment on porting that project?
I guess I could just import the source and header files...
That system also used the SDCC compiler.

Thanks, Peter

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2991
Re: Code size for a 8051 processor
« Reply #1 on: November 28, 2020, 12:49:57 am »
Quote
Is there really no way of changing that?
i am not familiar with this project type, but it is probably only a compiler or linker option....
Have a look at
Project->Build options->Select the project name on the left->Linker settings->Other linker options


Quote
I guess I could just import the source and header files...
probably the way to go... Setting the linker and compiler settings by hand...

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 770
Re: Code size for a 8051 processor
« Reply #2 on: November 28, 2020, 12:06:22 pm »
As BlueHazzard said it is a linker option. In the template you have, depending on selected compiler:

sdcc
Code
project.AddLinkerOption(_T("--code-size " + format("%u", SizeCODE)));

keilc51
Code
project.AddLinkerOption(_T("CODE(0x0-"  + format("0x%04X", SizeCODE - 1)  + ")"));

keilcx51
Code
 project.AddLinkerOption(_T("CLASSES (XDATA (X:0x0-X:" + format("0x%04X", SizeXDATA - 1) +
                                   "), HDATA (X:0x0-X:"  + format("0x%04X", SizeXDATA - 1) +
                                   "), CODE (C:0x0-C:"   + format("0x%04X", SizeCODE - 1) +
                                   "), CONST (C:0x0-C:"  + format("0x%04X", SizeCODE - 1) +
                                   "), ECODE (C:0x0-C:"  + format("0x%04X", SizeCODE - 1) +
                                   "), HCONST (C:0x0-C:" + format("0x%04X", SizeCODE - 1) + "))"));

iar8051
Code
project.AddLinkerOption(_T("-D_CODE0_END="  + format("0x%04x", SizeCODE - 1)));

Offline orbanp

  • Single posting newcomer
  • *
  • Posts: 2
Re: Code size for a 8051 processor
« Reply #3 on: November 28, 2020, 03:27:51 pm »
Thanks for the reply, I really appreciate it!

I did find the code size in the linker options, and could change it, as suggested.

Thanks again, Peter