2008-03-17 21:37:15 code in L1 on BF532
David Rowe (AUSTRALIA)
Message: 52621 Hi,
I just tried to move a kernel module function to L1:
int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)__attribute__((l1_text));
The module builds OK however when I insmod it I get:
root:/root> insmod oslec.ko
insmod: cannot insert 'oslec.ko': Operation not permitted (-1): Operation not permitted
When I remove the l1_text attribute it loads OK.
Is this attribute supported on the BF532? Perhaps there is another (say linker) option I need? It's really just this one function I want in L1.
In the boot sequence it looks like there is plenty of L1 instruction memory available:
<snip>
Blackfin Scratchpad data SRAM: 4 KB
Blackfin Instruction SRAM: 32 KB
<snip>
Aslo, I can see that the kernel is actually using some L1 (by examining /proc/kallsyms).
The function I wish to put into L1 is about 1k long and the kernel funcs in L1 are only using about 7k of the 32k available.
Thanks,
David
QuoteReplyEditDelete
2008-03-17 21:57:29 Re: code in L1 on BF532
Mike Frysinger (UNITED STATES)
Message: 52622 there is no variant-specific logic with attribute handling, nor are there special flags you need ... if the module is being rejected, it's for a different reason
look at /proc/sram to see how the L1 is being allocated
QuoteReplyEditDelete
2008-03-18 00:04:43 Re: code in L1 on BF532
David Rowe (AUSTRALIA)
Message: 52627 I think I found the reason, (at least in uClinux-dist-2007R1.1-RC3) around line 400 of linux-2.6.x/arch/blackfin/m,/blackfin_sram.c:
This:
void *l1_inst_sram_alloc(size_t size)
{
#if L1_DATA_A_LENGTH != 0
Should be:
void *l1_inst_sram_alloc(size_t size)
{
#if L1_CODE_LENGTH != 0
On the BF532 there is no L1 SRAM available but 32kb of L1 instruction memory available. When I made this mod to the kernel I could happily load functions into L1 instruction memory on the BF532, e.g. the test program from the blackfin docs site:
root:/tmp> insmod hello.ko
========Load module into L1 memory========
Code test: code function addr = 0xffa0a0f0
Cheers,
David
QuoteReplyEditDelete
2008-03-18 06:57:44 Re: code in L1 on BF532
Mike Frysinger (UNITED STATES)
Message: 52680 ah, ok ... i just checked at that has been fixed at some point between 2007R1.1 and 2008R1, so newer releases should be OK