News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Code size for a 8051 processor

Started by orbanp, November 27, 2020, 08:26:42 PM

Previous topic - Next topic

orbanp

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

BlueHazzard

QuoteIs 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


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

Miguel Gimenez

As BlueHazzard said it is a linker option. In the template you have, depending on selected compiler:

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

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

keilcx51
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
project.AddLinkerOption(_T("-D_CODE0_END="  + format("0x%04x", SizeCODE - 1)));


orbanp

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