summaryrefslogtreecommitdiff
path: root/common_modules/module_manager/src/txm_module_manager_absolute_load.c
blob: 3fc060001532005f7683588cf91ec3ec954e23b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/***************************************************************************
 * Copyright (c) 2024 Microsoft Corporation
 * Copyright (c) 2026 Eclipse ThreadX contributors
 *
 * This program and the accompanying materials are made available under the
 * terms of the MIT License which is available at
 * https://opensource.org/licenses/MIT.
 *
 * SPDX-License-Identifier: MIT
 **************************************************************************/

// Portions of this file were generated with AI assistance.


/**************************************************************************/
/**************************************************************************/
/**                                                                       */
/** ThreadX Component                                                     */
/**                                                                       */
/**   Module Manager                                                      */
/**                                                                       */
/**************************************************************************/
/**************************************************************************/

#define TX_SOURCE_CODE

#include "tx_api.h"
#include "txm_module.h"

#ifndef TXM_MODULE_MANAGER_ABSOLUTE_LOAD_CALL_NOT_USED

/* DEPRECATION NOTICE
 * txm_module_manager_absolute_load() is deprecated. Do not use it in new code.
 *
 * WHY: an absolutely located module has its code and its data placed at two
 * independent fixed addresses by the module's linker script. This service
 * receives only the code address, and the module preamble carries the code and
 * data sizes but not the data address. The module manager therefore has no way
 * to determine where the module's data area is, and cannot describe it in the
 * module instance. The affected fields are left empty by this wrapper.
 *
 * WHAT TO DO: replace calls with txm_module_manager_absolute_load_extended(),
 * passing the module's data area address as the fourth argument. That address
 * is the RAM segment start defined in the module's linker script.
 *
 * RISK: with the data area unknown, the module manager cannot tell whether an
 * object, a thread control block, or the trace buffer resides in the module's
 * data area, and a memory protection unit cannot be programmed to cover it.
 * Modules that request memory protection are therefore rejected with
 * TXM_MODULE_INVALID_PROPERTIES.
 *
 * Define TXM_MODULE_MANAGER_ABSOLUTE_LOAD_CALL_NOT_USED to remove this service
 * and this message from the build.
 */
#pragma message("txm_module_manager_absolute_load() is deprecated. " \
                "Use txm_module_manager_absolute_load_extended() and pass " \
                "the module's data area address.")

/**************************************************************************/
/*                                                                        */
/*  FUNCTION                                               RELEASE        */
/*                                                                        */
/*    _txm_module_manager_absolute_load                   PORTABLE C      */
/*                                                           6.5.2        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Andres Mlinar, Microsoft Corporation                                */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    DEPRECATED. Use _txm_module_manager_absolute_load_extended()        */
/*    instead, passing the module's data area address. This wrapper       */
/*    passes TX_NULL, which leaves the module instance's data area        */
/*    description empty because the module manager cannot derive the      */
/*    data area address of an absolutely located module. Modules that     */
/*    request memory protection are rejected with                         */
/*    TXM_MODULE_INVALID_PROPERTIES, because the memory protection        */
/*    hardware cannot be programmed to cover an unknown data area.        */
/*                                                                        */
/*  INPUT                                                                 */
/*                                                                        */
/*    module_instance                   Module instance pointer           */
/*    module_name                       Module name pointer               */
/*    module_location                   Module code location              */
/*                                                                        */
/*  OUTPUT                                                                */
/*                                                                        */
/*    status                            Completion status                 */
/*                                                                        */
/*  CALLS                                                                 */
/*                                                                        */
/*    _txm_module_manager_absolute_load_extended                          */
/*                                      Load the module                   */
/*                                                                        */
/*  CALLED BY                                                             */
/*                                                                        */
/*    Application code                                                    */
/*                                                                        */
/**************************************************************************/
UINT  _txm_module_manager_absolute_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, VOID *module_location)
{

UINT    status;


    /* Call the extended service with an unknown data area location.  */
    status =  _txm_module_manager_absolute_load_extended(module_instance, module_name, module_location, TX_NULL);

    /* Return completion status.  */
    return(status);
}
#endif