This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] RM48L952:我想读取堆栈指针、但是 i'm 收到错误信息。

Guru**** 2033340 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1451299/rm48l952-i-want-to-read-the-stack-pointer-but-i-m-getting-an-error

器件型号:RM48L952

工具与软件:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/** @file sys_main.c
* @brief Application main file
* @date 11-Dec-2018
* @version 04.07.01
*
* This file contains an empty main function,
* which can be used for the application.
*/
/*
* Copyright (C) 2009-2018 Texas Instruments Incorporated - www.ti.com
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

您好!

我在尝试读取代码中的堆栈指针时遇到了使用括号错误的问题。

是否有人能够解释为什么会发生此错误?

如果有任何帮助解决此问题的见解或建议、我将不胜感激。

感谢您投入宝贵的时间给予大力帮助!

此致、

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Kim、

    对延迟响应深表歉意。

    我已经在与我们的编译器团队讨论此问题、并将尽快尝试提供更新。

    ——
    谢谢、此致、
    Jagadish。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    假设您使用的是 TI Arm 编译器(简称为 armcl )、而不是 TI Arm Clang 编译器(简称为 tiarmclang )。  函数 get_sp 在第一个帖子中有一个 _asm 使用所谓的 GCC 语法的语句。  遗憾的是、TI Arm 编译器不支持此语法。   

    作为一种变通办法、请考虑...

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    #include <stdint.h>
    uintptr_t get_sp()
    {
    int64_t local_variable;
    return (uintptr_t)&local_variable + sizeof(local_variable);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    这是一个丑陋的黑客。  生成的代码会更大且更慢一些。  但计算结果相同。

    谢谢。此致、

    -George.