Microchip
直播中

h1654155275.5954

7年用户 207经验值
私信 关注
[问答]

SFR的地址定义在哪里?

您好,我不确定是否可以在这里发布(XC32论坛似乎有点死亡)。编辑:我正在寻找SFR寄存器的位置定义,我在PRO/P32 MX27 0F256B中找到了这些定义,但是我发现它们不是地址,而是SFR位置上的变量。我正在尝试加载SFR TrISB的地址,上面的定义不起作用。C地址操作符似乎不能正常工作。MIN。S:48:错误:绝对表达式需要“Lui $ 3,TrISB & Gt;G16;这里是源:γ包含& lt;xc.h & gt;.Global Meave.Text。设置NoAT.ENT主要的主要部分:LUI V1,TrISB & Gt;16;ORI V1,TrISB & 0xFFFF J主NOP。

以上来自于百度翻译


      以下为原文

    Hello, I wasn't sure if its OK to post this here or not(XC32 forum seems kinda dead).

edit:

I am trying to find the location defines for the SFR registers, I found the defines in proc/p32mx270f256b but I figured out they are not the addresses but are variables at the locations of the SFR.

For example I am trying to load the address of the SFR TRISB, the above define doesn't work the C address operator doesn't seem to be working correctly.

main.S:48: Error: Absolute expression required `lui $3,TRISB>>16'

Here is the source:

#include
    .global main
    .text
    .set noreorder
    .set nomacro
    .set noat
   
    .ent main
   
main:
    LUI v1, TRISB>>16
    ORI v1, TRISB & 0xFFFF
    J main
    NOP
    .end main


           

回帖(4)

李铭鑫

2019-3-11 09:25:46
HI,连同XC32编译器的安装,有几个汇编程序代码的例子:程序文件(x86)Microchip xC32 v1.43 示例CalulySO示例……包括一个程序,该程序执行一些端口控制操作:还需要几个汇编指令。迈西尔

以上来自于百度翻译


      以下为原文

    Hi,
Together with XC32 Compiler installation, there are a few examples of Assembler code program:
Program Files (x86)  Microchip  xc32  v1.43  examples  assembly_examples  ...
 
Including a program that do some Port control operations:
#include
#define IOPORT_BIT_7 (1 << 7)
   ...
   ori      a0, zero, IOPORT_BIT_7
   la      s0, LATACLR
   sw      a0, 0(s0)      /* clear specified bits */
There are several assembler directives also needed.
 
   Mysil
举报

李名扬

2019-3-11 09:41:52
嗨,谢谢你的帮助。我看到了这些例子,它们是有意义的,但是他们使用宏指令(LA,里县等),这些文件在任何地方都没有记录(甚至在IMGTEC网站上)。更基本的是,我想看看我是否能手动编码所有的东西,我不知道如何访问刚才的地址。C定义了上面列出的,如果我使用C地址运算符和PoBB,C中给出定义的地址,也会得到错误,并且该行没有被正确地处理。例如,如果我使用PoTB的地址:Lui V0,0xBF86110&Gt;G16.16ORI V0,0xBF86110&0xFFFFI将喜欢T。这是一个学术性的练习,不会为实际的实际发展而这样做。

以上来自于百度翻译


      以下为原文

    Hi, thank you for the help.
 
I saw those examples and they make sense but they use the macro instructions(LA, LI, etc) which aren't documented anywhere(even on imgtec website). 
 
More fundamentally though I wanted to see if I could code everything manually, I am unsure how to access just the address of the C defines listed above, if I used the C address operator &PORTB which in C would give the address of the definition I also get an error and the line isn't processed correctly.
 
As an example if I use the address of PORTB:
 
LUI v0, 0xBF886110>>16
ORI v0, 0xBF886110 & 0xFFFF
 
I would like to be able to do that with a define.
 
This is an academic exercise, wouldn't be doing this for actual real development.  
举报

李名扬

2019-3-11 10:00:47
好的,我发现SFR定义了,它们在PIC32 LIBS/PROC//LT;Primor文件夹和gt;//lt;处理器s&gt;汇编文件。GeeZe,两个星期后,我现在准备编写一个纯ASM程序。Microchip似乎对这些步骤不太感兴趣。

以上来自于百度翻译


      以下为原文

    Ok, I found the SFR defines, they are in the pic32-libs/proc// assembly file.
 
Geeze, after two weeks I am now setup to write a pure ASM program. Microchip doesn't seem too interested in detailing these steps.
举报

陈霞

2019-3-11 10:17:44
我一直在使用GNU工具链,只是使用数据表中的信息来维护我自己的定义。当然,也有一些像Pinguino这样可以提供可用文件的东西,虽然我不知道它们是否是Microchip提供的其他文件或其他东西。至于不同的指令,我似乎记得LA显然不是真正的指令。Falm是一个伪指令,它产生Li,但它的加载地址源于一个标签,它是由汇编程序查找的,而不是一个作为操作数立即可用的常数。但是,像GNU这样的东西,不管怎么说,都是可以互换的。我倾向于使用常量偏移量来传递任何给定的基寄存器的SET、CLR和IV变量。所以,像这样…显然,我必须定义CLR是适当的偏移量。

以上来自于百度翻译


      以下为原文

    I've been doing this using the GNU toolchain and just maintaining my own #defines using the information from the datasheets. Of course, there are also things like Pinguino that provide usable files for this purpose, although I don't know if they are the same files that Microchip provides or something else.
 
As for the different instructions, I seem to recall that la is apparently not a genuine instruction as such: it is effectively a pseudo-instruction producing li but with the loaded address originating from a label looked up by the assembler, as opposed to a constant immediately usable as an operand. But things like GNU as seem to treat them interchangeably anyway.
 
I tend to use the constant offset to communicate the SET, CLR and INV variants of any given base register. So, something like this...
 
la $s0, LATA
sw $a0, CLR($s0)
 
Obviously, I have to #define CLR to be the appropriate offset.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分