Keil for ARM function Absolute definition

Source: Internet
Author: User
I wrote a function, I want to put it in the 31st area of Flash, the address is 0x0801f000 this place, I searched a method on the net.
Although reached the effect of the online said add a __at, and contains the header file # include "Absacc.h"
This method applies only to the absolute definition of an array. Here's how:
U8 Testbuf[8] __at (0x0801f000) ={0x34,0x66,0x03,0x34,0x23,0x77,0x77,0x77};
But what about. For a function. For example void __at (0x0801f000) test_abc (void) {... Own code}; This method is not possible.
By looking at the flash found in Keil is empty. It means that his code is not put in;
Well, there's a way to do it online, but it's not what I want. Share it. The method is:
1, first for need to locate the function set section name, here I take main function as an example:
void __attribute__ (Section ("Mymain-here casually defines English name, I take Mymain as name"))) main (void)

2, in the distributed load file set main storage address:
App_load 0x00050000 OVERLAY
{
Main_exe +0
{
APP.O (Mymain); APP.O is the C file module where my main function is located app.c
;; Mymain is just a section of the definition that actually represents the main function of main
;; Here you can see the Mymain section (also known as the main function)
;; is placed at address 0x00050000, which completes function address positioning
}
App_exe +0
{
* (+ro)
}
};
Or take my function as an example,
1.void __attribute__ ((Section ("Abc_my"))) test_abc (void) {... Own code};
2.app_load 0x0801f000 OVERLAY
{
Main_exe +0
{
TEST.O (abc_my); My function test_abc put in test.c, then I change to TEST.O}
App_exe +0
{
* (+ro)
}
};

I have also realized the above methods of imitating others. But found that there was a problem 2;
The first question, at the address I'm going to put 0x0801f000, is that the code is not the FF FF FF that was detected in the past, and a suffix generated by Keil is called. Map file also found my function is placed in the 0x0801f000 range. But the position he put is 0x0801f001; This is the first question I've been puzzled about.
The second problem, in the suffix called. Map file. This file is a file that describes all of the contents of this program. I found the ones that were arranged behind him, like the Usart_init () function, and various functions. will be arranged in order as I change this 0x0801f000 address. Other words. I'll change my address. Other functions. The position is unchanged and all follow the order of the address behind it. It's not clear what to say. For example, a is my test procedure, a put 0x01, then the other program BCDEFG arrangement is 0x02;0x03;0x04;0x05;0x06;0x07; When I put my A to 0x21; then my other program. BCDEFG is coming with us. Followed the 0x22,0x23,0x24,0x25,0x26,0x27 in turn; This is the second question. More headaches.



Reprint: Keil for ARM function Absolute definition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.