Как разместить функцию по определенному адресу в C без использования #pragma?C++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Гость
 Как разместить функцию по определенному адресу в C без использования #pragma?

Сообщение Гость »


I want to place a function

Код: Выделить всё

void loadableSW (void)
at a specific location:

Код: Выделить всё

0x3FF802
. In another function

Код: Выделить всё

residentMain()
I will jump to this location using pointer to function. How to declare function

Код: Выделить всё

loadableSW
to accomplish this. I have attached the skeleton of

Код: Выделить всё

residentMain
for clarity.

Update: Target hardware is TMS320C620xDSP. Since this is an aerospace project, deterministic behaviour is a desirable design objective. Ideally, they would like to know what portion of memory contains what at a particular time. The solution as I just got to know is to define a section in memory in the linker file. The section shall start at

Код: Выделить всё

0x3FF802
(Location where to place the function). Since the size of the

Код: Выделить всё

loadableSW
function is known, the size of the memory section can also be determined. And then the directive

Код: Выделить всё

#pragma CODESECTION ("function_name", "section_name")
can place that function in the specified section.

Since directives are not permissible in test scripts, I am wondering if there is any other way to do this without using any linker directives.

Besides I am curious. Is there any placement syntax for functions in C++? I know there is one for objects, but functions?

Код: Выделить всё

    void residentMain (void)     {         void (*loadable_p) (void) = (void (*) (void)) 0x3FF802;         int hardwareOK = 0;              /*Code to check hardware integrity. hardwareOK = 1 if success*/              if (hardwareOK)         {             loadable_p (); /*Jump to Loadable Software*/         }         else         {             dspHalt ();         }     } 


Источник: https://stackoverflow.com/questions/197 ... ing-pragma
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • #pragma fenv_access (включено) и #pragma STDC FENV_ACCESS ON
    Anonymous » » в форуме C++
    0 Ответы
    46 Просмотры
    Последнее сообщение Anonymous
  • Я хочу добавить активность по определенному URL-адресу, используя «data-target».
    Anonymous » » в форуме Jquery
    0 Ответы
    18 Просмотры
    Последнее сообщение Anonymous
  • Я хочу добавить активность по определенному URL-адресу, используя «data-target».
    Anonymous » » в форуме CSS
    0 Ответы
    15 Просмотры
    Последнее сообщение Anonymous
  • Есть ли способ отслеживать UDP-трафик без привязки к определенному IP-адресу или порту?
    Anonymous » » в форуме JAVA
    0 Ответы
    12 Просмотры
    Последнее сообщение Anonymous
  • Обслуживание файла JSON по определенному URL-адресу для глубоких ссылок Android
    Anonymous » » в форуме Android
    0 Ответы
    15 Просмотры
    Последнее сообщение Anonymous

Вернуться в «C++»