How to build program code larger than 32KB

17 posts / 0 new
Last post
toughworld
Offline
Last seen:3 years 6 months ago
Joined:2015-05-12 09:55
How to build program code larger than 32KB

My program came to be larger than 32kb,Then can I build progam larger than 32KB.Of cource the code has to be store in external memory instead of the 32KB OTP.

Device:
MT_dialog
Offline
Last seen:4 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi toughworld,

Hi toughworld,

If your program exceeds the 32KB of the keil evaluation limit you can either aquire a full licence of keil or you can try to port you project to the GNU toolchain. There is a corresponding document in the application Notes section AN-B-024.pdf that has a short explanation about the porting procedure. The document isn't fully explanatory and the procedure isn't stable, the team is working on that in order to have a better description and a more standarized procedure.

Thanks MT_dialog

toughworld
Offline
Last seen:3 years 6 months ago
Joined:2015-05-12 09:55
sorry,I didn't make my

sorry,I didn't make my question clear.I have a full licence of keil.The error when i compile is Error: L6406E: No space in execution regions with .ANY selector matching prf_utils.o(.constdata)......which seems to be relevant to scartter file.

MT_dialog
Offline
Last seen:4 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi toughworld,

Hi toughworld,

Seems that the space allocated from the scatterfile is not enough, you will have to rearrange the scatterfile in order to accomodate a larger application in order to do this, you can try the following tips considering that you are using extended sleep and your code wont reside to the OTP:

1. Increase the ER_IROM5 by changing the scatterfile and setting the ER_IROM5 to ER_IROM5 0x20000440 0x7bc0 to gain 0xff space.

2.增加的代码空间ER_IROM5雷莫ving the RW_IRAM50 and add the available space in the ER_IROM5 section. Also you can move the RW_IRAM51 in a different address. A possible candidate to include the non-retained heap is the ZI_RET20 section. By doing this a continuous memory area from 0x20000440 to 0x20009000 of almost 35kB will be available for source code and RW data. In order to implement this follow the below instructions.

a. Remove the RW_IRAM50 and RW_IRAM51 sections

b. Change the size of the ER_IROM5 to ER_IROM5 0X20000440(0x9000 - 0x440)

c. The non retention heap will be moved, say in ZI_RET20, by adding the following line jump_table.o(heap_mem_area_not_ret) in both ZI_RET20 definitions.

Please check the UM-B-011.pdf file for more info regarding the memory map and the scatter files.

Thanks MT_dialog

toughworld
Offline
Last seen:3 years 6 months ago
Joined:2015-05-12 09:55
thanks,I get it.

thanks,I get it.

caiziee
Offline
Last seen:2 years 7 months ago
Joined:2016-07-29 10:01
Hi, Dialog

Hi, Dialog

Then if I do the modification as you said in scatter file, then the CODE RO and DATA RW size will be bigger than 32KB, smaller than 35KB. I remembered that the smartsnippets has a limitation for hex flashing (32KB). How can I flash it in that case?

Thanks a lot.

MT_dialog
Offline
Last seen:4 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi caiziee,

Hi caiziee,

I dont think that Smart Snippets will complain if you try to burn a binary 35KB, but you can always use hex2bin utilty in order to convert the .hex file into a .bin and then burn it to your flash.

Thanks MT_dialog

caiziee
Offline
Last seen:2 years 7 months ago
Joined:2016-07-29 10:01
Hi, Dialog

Hi, Dialog
When I use fromelf.exe from Keil, the bin file generated from hex turns to be quite big.
hex file size: 103KB.
bin file size: 515KB.

caiziee
Offline
Last seen:2 years 7 months ago
Joined:2016-07-29 10:01
Hi, Dialog

Hi, Dialog
I have tried this, but it failed.
Because in our application, there are many parts which are defined in scatter config file. The address are not continuous. When I use the hex2bin.exe, I got this output:
Lowest address = 00000000
Highest address = 00080857
Pad Byte = FF
8-bit Checksum = 9C
当我用智能片段闪过,I got an error "Size of data of selected file plus offset exceeds SPI FLASH memory size (131072 bytes)".

Could you please give me more hints about this? Thank you in advance.

MT_dialog
Offline
Last seen:4 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi caiziee,

Hi caiziee,

This is something related with your application, as mentioned in the other posthttps://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...is responsible that the linker outputs such a large binary. Please check your other post.

Thanks MT_dialog

caiziee
Offline
Last seen:2 years 7 months ago
Joined:2016-07-29 10:01
Thanks, Dialog.

Thanks, Dialog.

Ankit
Offline
Last seen:5 months 1 week ago
Joined:2017-05-24 07:42
Hi,

Hi,

I am using keil evaluation version. I am also facing same error.

1. Can I change ER_IROM5 and RW_IRAM50 section size? What will happen if I do so in keil evaluation version?
2.On what parameters ER_IROM5 and RW_IRAM50 section size are decided?
3. Is there any documentation which explains about ER_IROM5 , RW_IRAM50 and other section mentioned in scatter file?

MT_dialog
Offline
Last seen:4 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi Ankit,

Hi Ankit,

1. By just changing the scatter file, the keil wont complain, but if you try to build a code that is larger than 32K then keil will notify you about the limitation.

2.What do you mean on what parameters ? due to the OTP image space limitation, the available amount of memory in the scatter file is decided to be 32K.

3. You will be able to find some info regarding the memory placement in the UM-B-011.pdf document.

Thanks MT_dialog

zwffcb
Offline
Last seen:8 months 3 weeks ago
Joined:2017-04-18 10:26
Hi !

Hi !
I modified the .sct file according to the steps you said.
Remove the RW_IRAM50 and RW_IRAM51 sections and move jump_table.o(heap_mem_area_not_ret) in ZI_RET20 .
But what about RW_IRAM50? ignore it ?

#if (USE_MEMORY_MAP == EXT_SLEEP_SETUP)
.ANY (retention_mem_area0) ; application data
#endif
.ANY (+ZI)

thanks!

MT_dialog
Offline
Last seen:4 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi zwffcb,

Hi zwffcb,

Yes, you can totally remove the IRAM50 area, this area is reserved on the sysram since the map file is designed in order to operate under the 32KB limitation so any extra space should be allocated for additional uses, since you are trying to enlarge your code, you wont be using the OTP (for deep sleep etc), thus you can eliminate that area.

Thanks MT_dialog

zwffcb
Offline
Last seen:8 months 3 weeks ago
Joined:2017-04-18 10:26
Hi MT_dialog

Hi MT_dialog
Thank you for your answer.

1. Can I change these space address (LR_IROM1 to LR_IROM5) ,Because I still need little space to store my code.
thanks.

MT_dialog
Offline
Last seen:4 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi zwffcb,

Hi zwffcb,

Changing the scatter file for getting some extra code space isn't that simple, there are places in the memory region (defined by the scatter file) that cannot be ommited, to answer your question for changing the address space on the LR_IROM1. The ARM M0 requires that the IVT starts at 0x0 and this is what the LR_IROM1 defines, if you change that, you will mess with the IVT and that won't end up nice.

Thanks MT_dialog