Assembler (Inline) Topics

tinymce粘贴word插件powerpaste tinymce 4使用powerpaste-3.3.3-308, tinymce 5使用powerpaste-4.0.1-317, 内附demo 立即下载

Kapitel aus dem Microsoft Developers Network (MSDN), dem online-Handbuch im Microsoft Visual C++ Developer Studio :
Assembler (Inline) Topics
This article family explains what you need to know to use the Visual C/C++ inline assembler with Intel x86-series compatible processors (such as the AMD386 and the i486?/SUP>). 

What do you want to know more about?
Advantages of Inline Assembly

The __asm Keyword

Using Assembly Language in __asm Blocks

Using C or C++ in __asm Blocks

Using and Preserving Registers in Inline Assembly

Jumping to Labels in Inline Assembly

Calling C Functions in Inline Assembly

Calling C++ Functions in Inline Assembly

Defining __asm Blocks as C Macros

Optimizing Inline Assembly
Advantages of Inline Assembly
Top

Because the inline assembler doesn抰 require separate assembly and link steps, it is more convenient than a separate assembler. Inline assembly code can use any C variable or function name that is in scope, so it is easy to integrate it with your program抯 C code. Because the assembly code can be mixed inline with C or C++ statements, it can do tasks that are cumbersome or impossible in C or C++.

The uses of inline assembly include:

Writing functions in assembly language.

Spot-optimizing speed-critical sections of code.

Making direct hardware access for device drivers.

Writing prolog and epilog code for 搉aked?calls.
Inline assembly is a special-purpose tool. If you plan to port an application to different machines, you抣l probably want to place machine-specific code in a separate module. Because the inline assembler doesn抰 support all of Microsoft Macro Assembler抯 (MASM) macro and data directives, you may find it more convenient to use MASM for such modules.

The __asm Keyword
Top

The __asm keyword invokes the inline assembler and can appear wherever a C or C++ statement is legal. It cannot appear by itself. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at the very least, an empty pair of braces. The term ?B>__asm block?here refers to any instruction or group of instructions, whether or not in braces.

The following code fragment is a simple __asm block enclosed in braces:

__asm
{
   mov al, 2
   mov dx, 0xD007
   out al, dx
}

Alternatively, you can put __asm in front of each assembly instruction:

__asm mov al, 2
__asm mov dx, 0xD007
__asm out al, dx

Because the __asm keyword is a statement separator, you can also put assembly instructions on the same line:

__asm mov al, 2   __asm mov dx, 0xD007   __asm out al, dx

All three examples generate the same code, but the first style (enclosing the __asm block in braces) has some advantages. The braces clearly separate assembly code from C or C++ code and avoid needless repetition of the __asm keyword. Braces can also prevent ambiguities. If you want to put a C or C++ statement on the same line as an __asm block, you must enclose the block in braces. Without the braces, the compiler cannot tell where assembly code stops and C or C++ statements begin. Finally, because the text in braces has the same format as ordinary MASM text, you can easily cut and paste text from existing MASM source files.

Unlike braces in C and C++, the braces enclosing an __asm block don抰 affect variable scope. You can also nest __asm blocks; nesting does not affect variable scope.

Using Assembly Language in __asm Blocks
Top

The inline assembler has much in common with other assemblers. For example, it accepts any expression that is legal in MASM. This section describes the use of assembly-language features in __asm blocks.

What do you want to know more about?
Instruction Set for Inline Assembly

MASM Expressions in Inline Assembly

Data Directives and Operators in Inline Assembly

EVEN and ALIGN Directives

MASM Macro Directives in Inline Assembly

Segment References in Inline Assembly

Type and Variable Sizes in Inline Assembly

Assembly-Language Comments

The _emit Pseudoinstruction

Debugging and Listings for Inline Assembly

Intel抯 MMX Instruction Set
Instruction Set for Inline Assembly
Top

The inline assembler supports the full instruction set of the Intel 486 processor. Additional instructions supported by the target processor can be created with the _emit Pseudoinstruction.

MASM Expressions in Inline Assembly
Top

Inline assembly code can use any MASM expression, which is any combination of operands and operators that evaluates to a single value or address.

Data Directives and Operators in Inline Assembly
Top

Although an __asm block can reference C or C++ data types and objects, it cannot define data objects with MASM directives or operators. Specifically, you cannot use the definition directives DB, DW, DD, DQ, DT, and DF, or the operators DUP or THIS. MASM structures and records are also unavailable. The inline assembler doesn抰 accept the directives STRUC, RECORD, WIDTH, or MASK.

EVEN and ALIGN Directives
Top

Although the inline assembler doesn抰 support most MASM directives, it does support EVEN and ALIGN. These directives put NOP (no operation) instructions in the assembly code as needed to align labels to specific boundaries. This makes instruction-fetch operations more efficient for some processors.

MASM Macro Directives in Inline Assembly
Top

The inline assembler is not a macro assembler. You cannot use MASM macro directives (MACRO, REPT, IRC, IRP, and ENDM) or macro operators (<>, !, &, %, and .TYPE). An __asm block can use C preprocessor directives, however. See Using C or C++ in __asm Blocks for more information.

Segment References in Inline Assembly
Top

You must refer to segments by register rather than by name (the segment name _TEXT is invalid, for instance). Segment overrides must use the register explicitly, as in ES:[BX].

Type and Variable Sizes in Inline Assembly
Top

The LENGTH, SIZE, and TYPE operators have a limited meaning in inline assembly. They cannot be used at all with the DUP operator (because you cannot define data with MASM directives or operators). But you can use them to find the size of C or C++ variables or types:

The LENGTH operator can return the number of elements in an array. It returns the value 1 for non-array variables.

The SIZE operator can return the size of a C or C++ variable. A variable抯 size is the product of its LENGTH and TYPE.

The TYPE operator can return the size of a C or C++ type or variable. If the variable is an array, TYPE returns the size of a single element of the array.
For example, if your program has an 8-element int array,

int arr[8];

the following C and assembly expressions yield the size of arr and its elements.

__asm C Size
LENGTH arr sizeof(arr)/sizeof(arr[0]) 8
SIZE arr sizeof(arr) 16
TYPE arr sizeof(arr[0]) 2


Assembly-Language Comments
Top

Instructions in an __asm block can use assembly-language comments:

__asm mov ax, offset buff ; Load address of buff

Because C macros expand into a single logical line, avoid using assembly-language comments in macros. (See Defining __asm Blocks as C Macros.) An __asm block can also contain C-style comments; for more information, see Using C or C++ in __asm Blocks.

The _emit Pseudoinstruction
Top

The _emit pseudoinstruction is similar to the DB directive of MASM. You use _emit to define a single immediate byte at the current location in the current text segment. However, _emit can define only one byte at a time, and it can only define bytes in the text segment. It uses the same syntax as the INT instruction.

The following fragment places the given bytes into the code:

#define randasm __asm _emit 0x4A __asm _emit 0x43 __asm _emit 0x4B
 .
 .
 .
__asm {
     randasm
     }

Debugging and Listings for Inline Assembly
Top

Programs containing inline assembly code can be debugged with a source-level debugger if you compile with the /Zi option.

Within the debugger, you can set breakpoints on both C or C++ and assembly-language lines. If you enable mixed assembly and source mode, you can display both the source and disassembled form of the assembly code.

Note that putting multiple assembly instructions or source language statements on one line can hamper debugging. In source mode, you can use the debugger to set breakpoints on a single line but not on individual statements on the same line. The same principle applies to an __asm block defined as a C macro, which expands to a single logical line.

If you create a mixed source and assembly listing with the /FAs compiler option, the listing contains both the source and assembly forms of each assembly-language line. Macros are not expanded in listings, but they are expanded during compilation.

Intel's MMX Instruction Set
Top

The Visual C++ compiler allows you to use Intel's MMX (multimedia extension) instruction set in the inline assembler. The MMX instructions are also supported by the debugger disassembly. The MMX registers are not supported in the debugger register window. The compiler generates a warning message if the function contains MMX instructions, but does not have an EMMS instruction to empty the multimedia state. For more information, see the Intel Web site.

Using C or C++ in __asm Blocks
Top

Because inline assembly instructions can be mixed with C or C++ statements, they can refer to C or C++ variables by name and use many other elements of those languages.

An __asm block can use the following language elements:

Symbols, including labels and variable and function names

Constants, including symbolic constants and enum members

Macros and preprocessor directives

Comments (both /* */ and // )

Type names (wherever a MASM type would be legal)

typedef names, generally used with operators such as PTR and TYPE or to specify structure or union members
Within an __asm block, you can specify integer constants with either C notation or assembler radix notation (0x100 and 100h are equivalent, for example). This allows you to define (using #define) a constant in C and then use it in both C or C++ and assembly portions of the program. You can also specify constants in octal by preceding them with a 0. For example, 0777 specifies an octal constant.

What do you want to know more about?
Using Operators in __asm Blocks

Using C or C++ Symbols_in __asm Blocks

Accessing C or C++ Data in __asm Blocks

Writing Functions with Inline Assembly
Using Operators in __asm Blocks
Top

An __asm block cannot use C or C++ specific operators, such as the << operator. However, operators shared by C and MASM, such as the * operator, are interpreted as assembly-language operators. For instance, outside an __asm block, square brackets ([ ]) are interpreted as enclosing array subscripts, which C automatically scales to the size of an element in the array. Inside an __asm block, they are seen as the MASM index operator, which yields an unscaled byte offset from any data object or label (not just an array). The following code illustrates the difference:

int array[10];

__asm mov array[6], bx ;  Store BX at array+6 (not scaled)

array[6] = 0;         /* Store 0 at array+12 (scaled) */

The first reference to array is not scaled, but the second is. Note that you can use the TYPE operator to achieve scaling based on a constant. For example, the following statements are equivalent:

__asm mov array[6 * TYPE int], 0 ; Store 0 at array + 12

array[6] = 0;                   /* Store 0 at array + 12 */

Using C or C++ Symbols in __asm Blocks
Top

An __asm block can refer to any C or C++ symbol in scope where the block appears. (C and C++ symbols are variable names, function names, and labels; that is, names that aren抰 symbolic constants or enum members. You cannot call C++ member functions.)

A few restrictions apply to the use of C and C++ symbols:

Each assembly-language statement can contain only one C or C++ symbol. Multiple symbols can appear in the same assembly instruction only with LENGTH, TYPE, and SIZE expressions.

Functions referenced in an __asm block must be declared (prototyped) earlier in the program. Otherwise, the compiler cannot distinguish between function names and labels in the __asm block.

An __asm block cannot use any C or C++ symbols with the same spelling as MASM reserved words (regardless of case). MASM reserved words include instruction names such as PUSH and register names such as SI.

Structure and union tags are not recognized in __asm blocks.
Accessing C or C++ Data in __asm Blocks
Top

A great convenience of inline assembly is the ability to refer to C or C++ variables by name. An __asm block can refer to any symbols, including variable names, that are in scope where the block appears. For instance, if the C variable var is in scope, the instruction

__asm mov eax, var

stores the value of var in EAX.

If a class, structure, or union member has a unique name, an __asm block can refer to it using only the member name, without specifying the variable or typedef name before the period (.) operator. If the member name is not unique, however, you must place a variable or typedef name immediately before the period operator. For example, the following structure types share same_name as their member name:

struct first_type
{
   char *weasel;
   int same_name;
};

struct second_type
{
   int wonton;
   long same_name;
};

If you declare variables with the types

struct first_type hal;
struct second_type oat;

all references to the member same_name must use the variable name because same_name is not unique. But the member weasel has a unique name, so you can refer to it using only its member name:

__asm
{
   mov ebx, OFFSET hal
   mov ecx, [ebx]hal.same_name ; Must use 'hal'
   mov esi, [ebx].weasel       ; Can omit 'hal'
}

Note that omitting the variable name is merely a coding convenience. The same assembly instructions are generated whether or not the variable name is present.

You can access data members in C++ without regard to access restrictions. However, you cannot call member functions.

Writing Functions with Inline Assembly
Top

If you write a function with inline assembly code, it抯 easy to pass arguments to the function and return a value from it. The following examples compare a function first written for a separate assembler and then rewritten for the inline assembler. The function, called power2, receives two parameters, multiplying the first parameter by 2 to the power of the second parameter. Written for a separate assembler, the function might look like this:

; POWER.ASM
; Compute the power of an integer
;
       PUBLIC _power2
_TEXT SEGMENT WORD PUBLIC 'CODE'
_power2 PROC

        push ebp        ; Save EBP
        mov ebp, esp    ; Move ESP into EBP so we can refer
                        ;   to arguments on the stack
        mov eax, [ebp+4] ; Get first argument
        mov ecx, [ebp+6] ; Get second argument
        shl eax, cl     ; EAX = EAX * ( 2 ^ CL )
        pop ebp         ; Restore EBP
        ret             ; Return with sum in EAX

_power2 ENDP
_TEXT   ENDS
        END

Since it抯 written for a separate assembler, the function requires a separate source file and assembly and link steps. C and C++ function arguments are usually passed on the stack, so this version of the power2 function accesses its arguments by their positions on the stack. (Note that the MODEL directive, available in MASM and some other assemblers, also allows you to access stack arguments and local stack variables by name.)

The POWER2.C program writes the power2 function with inline assembly code:

/* POWER2.C */
#include <stdio.h>

int power2( int num, int power );

void main( void )
{
   printf( "3 times 2 to the power of 5 is %d/n", /
           power2( 3, 5) );
}
int power2( int num, int power )
{
   __asm
   {
      mov eax, num    ; Get first argument
      mov ecx, power  ; Get second argument
      shl eax, cl     ; EAX = EAX * ( 2 to the power of CL )
   }
   /* Return with result in EAX */
}

The inline version of the power2 function refers to its arguments by name and appears in the same source file as the rest of the program. This version also requires fewer assembly instructions.

Because the inline version of power2 doesn抰 execute a C return statement, it causes a harmless warning if you compile at warning level 2 or higher. The function does return a value, but the compiler cannot tell that in the absence of a return statement. You can use #pragma warning to disable the generation of this warning.

Using and Preserving Registers in Inline Assembly
Top

In general, you should not assume that a register will have a given value when an __asm block begins. Register values are not guaranteed to be preserved across separate __asm blocks. If you end a block of inline code and begin another, you cannot rely on the registers in the second block to retain their values from the first block. An __asm block inherits whatever register values result from the normal flow of control.

If you use the __fastcall calling convention, the compiler passes function arguments in registers instead of on the stack. This can create problems in functions with __asm blocks because a function has no way to tell which parameter is in which register. If the function happens to receive a parameter in EAX and immediately stores something else in EAX, the original parameter is lost. In addition, you must preserve the ECX register in any function declared with __fastcall.

To avoid such register conflicts, don抰 use the __fastcall convention for functions that contain an __asm block. If you specify the __fastcall convention globally with the /Gr compiler option, declare every function containing an __asm block with __cdecl or __stdcall. (The __cdecl attribute tells the compiler to use the C calling convention for that function.) If you are not compiling with /Gr, avoid declaring the function with the __fastcall attribute.

When using __asm to write assembly language in C/C++ functions, you don't need to preserve the EAX, EBX, ECX, EDX, ESI, or EDI registers. For example, in the POWER2.C example in Writing Functions with Inline Assembly, the power2 function doesn't preserve the value in the EAX register. However, using these registers will affect code quality because the register allocator cannot use them to store values across __asm blocks. In addition, by using EBX, ESI or EDI in inline assembly code, you force the compiler to save and restore those registers in the function prologue and epilogue.

You should preserve other registers you use (such as DS, SS, SP, BP, and flags registers) for the scope of the __asm block. You should preserve the ESP and EBP registers unless you have some reason to change them (to switch stacks, for example). Also see Optimizing Inline Assembly.

Note   If your inline assembly code changes the direction flag using the STD or CLD instructions, you must restore the flag to its original value.

Jumping to Labels in Inline Assembly
Top

Like an ordinary C or C++ label, a label in an __asm block has scope throughout the function in which it is defined (not only in the block). Both assembly instructions and goto statements can jump to labels inside or outside the __asm block.

Labels defined in __asm blocks are not case sensitive; both goto statements and assembly instructions can refer to those labels without regard to case. C and C++ labels are case sensitive only when used by goto statements. Assembly instructions can jump to a C or C++ label without regard to case.

The following code shows all the permutations:

void func( void )
{
   goto C_Dest;  /* Legal: correct case   */
   goto c_dest;  /* Error: incorrect case */

   goto A_Dest;  /* Legal: correct case   */
   goto a_dest;  /* Legal: incorrect case */

   __asm
   {
      jmp C_Dest ; Legal: correct case
      jmp c_dest ; Legal: incorrect case

      jmp A_Dest ; Legal: correct case
      jmp a_dest ; Legal: incorrect case

      a_dest:    ; __asm label
   }

   C_Dest:       /* C label */
   return;
}

Don抰 use C library function names as labels in __asm blocks. For instance, you might be tempted to use exit as a label, as follows:

; BAD TECHNIQUE: using library function name as label
jne exit
   .
   .
   .
exit:
   ; More __asm code follows

Because exit is the name of a C library function, this code might cause a jump to the exit function instead of to the desired location.

As in MASM programs, the dollar symbol ($) serves as the current location counter. It is a label for the instruction currently being assembled. In __asm blocks, its main use is to make long conditional jumps:

jne $+5 ; next instruction is 5 bytes long
jmp farlabel
; $+5
   .
   .
   .
farlabel:

Calling C Functions in Inline Assembly
Top

An __asm block can call C functions, including C library routines. The following example calls the printf library routine:

#include <stdio.h>

char format[] = "%s %s/n";
char hello[] = "Hello";
char world[] = "world";
void main( void )
{
   __asm
   {
      mov  eax, offset world
      push eax
      mov  eax, offset hello
      push eax
      mov  eax, offset format
      push eax
      call printf
      //clean up the stack so that main can exit cleanly
      //use the unused register ebx to do the cleanup
      pop  ebx
      pop  ebx
      pop  ebx
   }
}

Because function arguments are passed on the stack, you simply push the needed arguments梥tring pointers, in the previous example梑efore calling the function. The arguments are pushed in reverse order, so they come off the stack in the desired order. To emulate the C statement

printf( format, hello, world );

the example pushes pointers to world, hello, and format, in that order, and then calls printf.

Calling C++ Functions in Inline Assembly
Top

An __asm block can call only global C++ functions that are not overloaded. If you call an overloaded global C++ function or a C++ member function, the compiler issues an error.

You can also call any functions declared with extern "C" linkage. This allows an __asm block within a C++ program to call the C library functions, because all the standard header files declare the library functions to have extern "C" linkage.

Defining __asm Blocks as C Macros
Top

C macros offer a convenient way to insert assembly code into your source code, but they demand extra care because a macro expands into a single logical line. To create trouble-free macros, follow these rules:

Enclose the __asm block in braces.

Put the __asm keyword in front of each assembly instruction.

Use old-style C comments ( /* comment */) instead of assembly-style comments ( ; comment) or single-line C comments ( // comment).
To illustrate, the following example defines a simple macro:

#define PORTIO __asm      /
/* Port output */         /
{                         /
   __asm mov al, 2        /
   __asm mov dx, 0xD007   /
   __asm out al, dx       /
}

At first glance, the last three __asm keywords seem superfluous. They are needed, however, because the macro expands into a single line:

__asm /* Port output */ { __asm mov al, 2  __asm mov dx, 0xD007 __asm out al, dx }

The third and fourth __asm keywords are needed as statement separators. The only statement separators recognized in __asm blocks are the newline character and __asm keyword. Because a block defined as a macro is one logical line, you must separate each instruction with __asm.

The braces are essential as well. If you omit them, the compiler can be confused by C or C++ statements on the same line to the right of the macro invocation. Without the closing brace, the compiler cannot tell where assembly code stops, and it sees C or C++ statements after the __asm block as assembly instructions.

Assembly-style comments that start with a semicolon (;) continue to the end of the line. This causes problems in macros because the compiler ignores everything after the comment, all the way to the end of the logical line. The same is true of single-line C or C++ comments ( // comment). To prevent errors, use old-style C comments ( /* comment */) in __asm blocks defined as macros.

An __asm block written as a C macro can take arguments. Unlike an ordinary C macro, however, an __asm macro cannot return a value. So you cannot use such macros in C or C++ expressions.

Be careful not to invoke macros of this type indiscriminately. For instance, invoking an assembly-language macro in a function declared with the __fastcall convention may cause unexpected results. (See Using and Preserving Registers in Inline Assembly.)

Optimizing Inline Assembly
Top

The presence of an __asm block in a function affects optimization in several ways. First, the compiler doesn抰 try to optimize the __asm block itself. What you write in assembly language is exactly what you get. Second, the presence of an __asm block affects register variable storage. The compiler avoids enregistering variables across an __asm block if the register抯 contents would be changed by the __asm block. Finally, some other function-wide optimizations will be affected by the inclusion of assembly language in a function.

tinymce powerpaste插件(兼容最新tinymce5.2.0) tinymce powerpaste插件,兼容最新的tinymce5.2.0版本。解压后放到plugins目录 立即下载

相关推荐

Truncated SVD for faster dection

Truncated SVD方法最先被提出在《Fast R-CNN》论文中,用于降低全连接层的运算量,提升模型的速度。在卷积神经网络的分类任务中,FC层的运算速度远远大于CONV层,而在Fast R-CNN的目标检测任务中,大多数的运算时间发生在FC 的运算中,是因为针对每张输入图片,只进行一次卷积操作,而要对生成的Region Proposal,大致两千个,进行全连接操作进行分类与Bounding...

weixin_35747666的博客 1543

dokuwiki编辑器支持PowerPoint粘帖

3.基础配置 powerpaste_allow_local_images: true, //powerpaste允许黏贴 powerpaste_word_import: "clean", // 是否保留word粘贴样式 clean | merge (具体可查看官方文档)powerpaste_word_import: "clean", //powerpaste黏贴的样式获取方式。skin_url: "/static/skins/ui/oxide", // tinymce UI引入。

weixin_45525177的博客 231

基于AIS动态数据与AI结合得经纬度标示算法

港口船舶智能标注系统 本系统通过结合摄像头视频流和AIS船舶动态数据,利用AI技术实现船舶实时标注功能。系统架构包括视频流处理、AIS数据解析、船舶检测匹配和坐标映射转换等模块。关键技术步骤: AIS数据获取:通过本地接收机或网络API获取船舶位置、航速等信息 AI目标检测:采用YOLOv8等模型识别视频中的船舶 船舶匹配算法:通过位置投影或运动轨迹匹配视频目标与AIS数据 坐标映射:使用相机标定技术将经纬度转换为图像坐标 实时标注:在视频画面上叠加船名、位置等关键信息 应用场景包括港口监控、智能海事管理和

qianbo042311的博客 1820

ARM嵌入式开发中的GCC内联汇编(ARM GCC Inline Assembler Cookbook)

ARM嵌入式开发中的GCC内联汇编简介 原文:http://blog.csdn.net/ce123/article/details/8209702/ 在针对ARM体系结构的编程中,一般很难直接使用C语言产生操作协处理器的相关代码,因此使用汇编语言来实现就成为了唯一的选择。但如果完全通过汇编代码实现,又会过于复杂、难以调试。因此,C语言内嵌汇编的方式倒是一个不错的选择。然而,使用内联汇编

none 3252

为什么需要知识图谱?什么是知识图谱?——KG的前世今生

我的知乎专栏,对知识图谱感兴趣的朋友可以关注。标题的命名顺序可能让有的读者不太习惯。通常在介绍一个陌生事物的应用前,我们先给出其定义。之所以换个顺序,是为了不让读者一开始就接触比较冰冷生硬的概念刻板描述(后面我尽量用更具体、准确的例子来表达),另一方面也是为了通过现实生活中的例子自然的引入知识图谱的概念。希望通过这种方式加深读者的印象和理解。为了减轻读者理解的负担,我尽可能地避免引入过多的概念和技术

SimmerChan的专栏 8万+

基于STM32的智能婴儿床设计(蓝牙通信+摄像头监控)_315

本项目设计并实现了一款基于STM32微控制器的智能婴儿床系统,通过多种传感器和智能控制模块为家长提供更便捷和高效的婴儿照护解决方案。系统包括婴儿哭泣检测、湿度监测、空气质量检测、温度监控等多项功能,并通过蓝牙与手机APP进行数据传输和远程控制。婴儿床内置摇摇床和安抚音乐播放功能,能够在婴儿哭泣时自动启动摇摇床并播放安抚音乐。此外,系统还支持摄像头远程监控,让家长实时查看婴儿的状态。整个系统采用STM32F103RCT6作为核心控制单元,结合声音传感器、湿度传感器、MQ135空气质量传感器。

872

ARM GCC Inline Assembler Cookbook

转载自:http://www.ethernut.de/en/documents/arm-inline-asm.html About this document The GNU C compiler for ARM RISC processors offers, to embed assembly language code into C programs. This cool fe

be happy 879

硬件工程师笔记——电子器件汇总大全

本文系统总结了14种常用电子器件的工作原理及功能应用,包括电阻、压敏电阻、电容、电感、二极管、三极管、MOS管、晶振、光耦、IGBT、继电器、磁珠、可控硅和线性稳压器。每种器件从结构原理、工作特性到典型应用进行全面解析,如电阻的限流分压、电容的储能滤波、三极管的放大开关等。重点阐述了各器件在电路设计中的关键作用,如IGBT的功率控制、继电器的隔离保护、LDO的电压稳定等,并提供了实际电路应用案例。文章还整理了硬件工程师笔试面试相关的知识点和真题资源,为电子工程师提供全面的技术参考。

XU157303764的博客 2万+

MDK4版本3.80编译正点原子的SYSTEM出现错误 Inline assembler not permitted when generating Thumb code

void WFI_SET(void){__ASM volatile("wfi");  }//关闭所有中断void INTX_DISABLE(void){  __ASM volatile("cpsid i");}//开启所有中断void INTX_ENABLE(void){__ASM volatile("cpsie i");  }//设置栈顶地址//addr:栈顶地址__asm void MSR_M...

博闻天下-lei的博客 3339

YOLO26改进策略【模型轻量化】| 替换骨干网络 CVPR-2024 StarNet,超级精简高效的轻量化模块

本文记录的是。YOLO26主要用于轻量化应用部署,相关轻量化改进与其整体架构非常适配。StarNet设计简洁,没有复杂的设计和精细调整的超参数,仅是一个 4 阶段的分层架构。并且其中能够在低维空间计算的同时考虑极高维的特征这一特性,进而提高模型精度。本文在替换骨干网络中配置了原论文中的starnet_s1starnet_s2starnet_s3和starnet_s4七种模型,以满足不同的需求。

Limiiiing的博客 1116

RH850系列芯片深度剖析 1.5-链接(ld)文件解析

基础编译过程分为四个阶段:预处理(Preprocessing)、编译(Compilation)、汇编(Assembly)、链接(Linking)。执行这四个阶段的程序(预处理器、编译器、汇编器、和链接器)一起构成了编译系统。CONSTANTS接下来的内存空间定义部分会使用这些常量来定义内存空间的范围,理论上来说不定义常量也没有影响,直接用魔鬼数字代替,定义常量的主要目的就是方便理解以及方便修改;从示例中可以看出,常量的值可以为16进制或者10十进制,而且10进制支持数量级单位(k级,M级);

本博客专注于嵌入式软件领域技术分享。 1436

IOS开发笔记:编译时出现的错误

1、"std::ios_base::Init::~Init()", referenced from 出现这样的编译问题,是需要再加进libstdc++.dylib和libstdc++.6.dylib(为6.1使用) 2、apple Mach-o Linker error通常是因为compile source中有相同的.m文件  3、如果在真机中进行测试时出现failed to

意林的专栏 6万+

特殊通信领域场景应用:基于Simulink的数字预失真(DPD)算法仿真建模示例

增益压缩:高功率输入时输出信号的增益下降。相位失真:输入信号的相位随功率变化而改变。带外干扰:非线性失真会引入额外的频谱分量,影响邻道信号。多项式模型:用多项式拟合功率放大器的非线性特性。查找表(LUT):通过离线训练生成预失真映射表。自适应算法:实时调整预失真参数以动态补偿失真。发送端:生成随机比特流并调制为射频信号。预失真模块:对输入信号进行预失真处理。功率放大器模块:模拟非线性失真。接收端:解调信号并评估误码率(BER)。

xiaoheshang_123的博客 277

编译原子哥的SYSTEM出现错误 Inline assembler not permitted when generating Thumb code

原文地址::http://www.openedv.com/posts/list/0/55803.htm;jsessionid=BF32A849CB8EF733FEEC85010EBCE48C void WFI_SET(void) { __ASM volatile("wfi");   } //关闭所有中断 void INTX_DISABLE(void) {   __ASM v

xqhrs232的专栏 8162

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

vscode 所有的默认配置项

快速打开 使用快捷键 Ctrl+Shift+P ,然后搜索setting 首选项:打开默认设置(json),这个打开的是defaultSettings.json文件 可以在你的默认配置中看到这些,然后自己配置的时候,不懂的地方,可以参考这里 { // 控制在差异编辑器中是否把前导空格或尾随空格的改动显示为差异。 "diffEditor.ignoreTrimWhitespace": tru...

沧笙踏歌的博客 7万+

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

vue中tinymce的使用

vue中使用tinymce富文本编辑器 (我这里是vue2,vue3不是写在public下,具体的可以搜搜 看看) 3.在public中新建 tinymce 文件夹 把三个文件复制进去 4.在components文件夹中新建tinymce.vue (中文文件,自己去官网下载也可以,我这里下载下来的不能用,所以就用的这个) 5.使用 【如果用的elementui el-dialog 那么富文本编辑器的功能可能会被el-dialog覆盖,导致功能不能使用】 解决办法: 找到刚刚复制的skin.

LJJONESEED的博客 1万+

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

you try to use the STM32 Library examples with IAR 6.30.6 you get a loot of error

IAR  tips and tricks Home Page STM32 home page  CMSIS build problems with IAR Embedded Workbench ver. 6.30.6CMSIS build problems with IAR Embedded Workbench ver. 6.20How to use EWARM 6

niepangu的专栏 3718

宏和预处理器详述

宏和预处理器详述 2011-09-03 15:43:31   Macro(宏)来源于希腊语,意思就是大,远.在计算机科学中指的是规则,这个规则指定了输入和输出之间的关系(是不是优点类似于函数?).所有的宏都是一个概念,那就是输入与输出之间的映射关系,这个和函数本质上是相同的.但是宏和函数处理方式基本上是不同的,比如在C语言中,宏是在preprocess阶段被替换掉,而函数(讨论一般意义上的函数

gencheng的专栏 2319

Keil 5 ARMCC编译错误和警告解释大全(2) 序列号1000-2000

Keil 5 ARMCC编译错误和警告解释大全(2) 序列号1000-2000

Miao8miao的博客 2580

Keil4编译原子哥的SYSTEM出现错误error: #1113: Inline assembler not permitted when generating Thumb cod

原文地址:点击打开链接 由于版本问题Keil4编译原子哥的SYSTEM会出现此.c文件错误:void WFI_SET(void){__ASM volatile("wfi");  }//关闭所有中断void INTX_DISABLE(void){  __ASM volatile("cpsid i");}//开启所有中断void INTX_ENABLE(void){__ASM volatile("cp...

qq_34593278的博客 5935

在IAR中调试stm32工程文件时,出现的问题

MSIS build problems with IAR Embedded Workbench ver. 6.30.6 If you try to use the STM32 Library examples with IAR 6.30.6 you get a loot of errors. Below there is the solution. The customer's fi

Big Mind Stories 1万+

推荐一篇讲arm架构gcc内联汇编的文章

var ua = navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i)=="micromessenger") { location.href='http://blog.chinaunix.net/article.php?url='+ window.location.href; } .Blog

IC_SOC_ARM 1689

ARM GCC 内嵌(inline)汇编手册

  ARM GCC 内嵌(inline)汇编手册关于这篇文档对于基于ARM的RISC处理器,GNU C编译器提供了在C代码中内嵌汇编的功能。这种非常酷的特性提供了C代码没有的功能,比如手动优化软件关键部分的代码、使用相关的处理器指令。这里设想了读者是熟练编写ARM汇编程序读者,因为该片文档不是ARM汇编手册。同样也不是C语言手册。这篇文档假设使用的是GCC 4 的版本,但是

hanhannina的专栏 1914

ARM GCC的内联汇编详解 (ARM GCC Inline Assembler Cookbook)

说明:  在linux内核源码中,定义了一个__asm__的宏,其定义为:        #define __asm__ asm  另外有一个经常和 __asm__一起被用到的宏 __volatile__ 定义如下:       #define __volatile__ volatile    下面的文章中是直接用 asm ,但是,我们在linux的源码中看到的大部分都是 __asm

duanlove(技术路途)专栏 7299
上一篇: 内联汇编基础知识
下一篇: CTreeCtrl使用详细说明
普通网友
博客等级 码龄22年 1万+粉丝 2784原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值