AnsweredAssumed Answered

LDF assembly directives

Question asked by AviMagos on Jan 19, 2014
Latest reply on Jan 29, 2014 by CraigG

Hi I'm using BF516F.

 

Due to some constraint I can't remember, I can't have single output segments in the ldf that are initialized and are larger than 64KB (something to do with flash page or block size or whatever).

 

Therefore If I have an array larger than 64KB that I want to initialize with pre-calculated data, I have to split it into 2 variables, place each in a different input section and in the LDF file I use separate sections as follows:

 

c file:

 

#pragma section("example_var")

u8 array1[65536] = {#include "init_filename1"};

#pragma section("cont_var")

u8 array2[65536] = {#include "init_filename2"};

 

 

.ldf file:

segment1

{

     INPUT_SECTIONS($OBJECTS(example_var)...

} >MEM_SDRAM0_BANK3

 

segment2

{

     INPUT_SECTIONS($OBJECTS(cont_var)...

}>MEM_SDRAM0_BANK3

 

So far so good - this trick works nicely.

Problem is that I want the rest of the runtime code to be completely unaware of this artificial split in data. Meaning that I want both sections to be read from flash into a single address bank in the SDRAM. (meaning that the data from "coint_var" will be consecutive to the "example_var" and de-facto I can access array1[0..128K]) so that I can run over the entire array in a single loop for example.

For now this result seems to happen anyway since ldf is compiled serially and directives are exactly one after the other.

However if for some reason Bank3 might run out of space I'm afraid the linker will start moving sections around.

Is there anyway I can force it to place both segments consecutively in the SDRAM memory??? (some start address directive maybe? it would also nice if address were not hardcoded - meaning that I can write start_address(cont_var) = end_address(examble_var) or something like that...

 

Thanks,

Amit&Avi.

Outcomes