Compile not optimized Libgcc for ARM
Good morning,
I need to compile libgcc from scratch without deploying the ARM optimized version which is defined in ieee754-sf.s in the ARM back-end. Does anyone knows how to configure GCC for excluding ieee754-sf.s ( in libgcc/config/arm ) to compile from scratch libgcc, in particular compiling vanilla floating-point soft-fp emulation which is in libgcc/spft-fp ?
Thanks
See also questions close to this topic
-
How gcc optimize sum from 1 to 100 into 5050
I compiled following c program with
gcc -O3 -S a.c
:#include <stdio.h> int main() { int sum = 0; for (int i = 0; i <= 100; i++) { sum += i; } printf("%d", sum); }
The generated assembly code is as follow:
.section __TEXT,__text,regular,pure_instructions .build_version macos, 10, 15 sdk_version 10, 15, 4 .globl _main ## -- Begin function main .p2align 4, 0x90 _main: ## @main .cfi_startproc ## %bb.0: pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset %rbp, -16 movq %rsp, %rbp .cfi_def_cfa_register %rbp leaq L_.str(%rip), %rdi movl $5050, %esi ## imm = 0x13BA xorl %eax, %eax callq _printf xorl %eax, %eax popq %rbp retq .cfi_endproc ## -- End function .section __TEXT,__cstring,cstring_literals L_.str: ## @.str .asciz "%d" .subsections_via_symbols
As if GCC ran the code and notice that the loop times are determined and GCC replaced the whole calculating with the result 5050.
movl $5050, %esi
How does gcc do this kind of optimization? What's the academic name of this kind of optimization?
-
Use of empty tag struct, compiler claims I'm missing initializer, except I'm not
Okay, I know this is similar to this Why is the compiler throwing this warning: "missing initializer"? Isn't the structure initialized?, but surely GCC isn't stupid enough to think I meant to initialize something which has NO initialization?.
//main.cpp struct IsNamed{ }; template<typename T> struct Test{ int foo; }; struct Test2 : public Test<double>, public IsNamed{ }; int main(){ Test2 x; Test2 y = Test2{Test<double>{}}; return 0; }
Here's the output:
main2.cpp: In function 'int main()': main2.cpp:18:35: warning: missing initializer for member 'Test2::<anonymous>' [-Wmissing-field-initializers] 18 | Test2 y = Test2{Test<double>{}}; | ^ main2.cpp:16:11: warning: unused variable 'x' [-Wunused-variable] 16 | Test2 x; | ^ main2.cpp:18:11: warning: variable 'y' set but not used [-Wunused-but-set-variable] 18 | Test2 y = Test2{Test<double>{}}; |
The only warning I'm confused about is this " missing initializer for member 'Test2:: " warning. It makes no sense. There's only one possible value I would need, and I provide it. Just to prove that it is indeed the inclusion of the empty class in the inheritance chain that is causing this, here's the output if I remove it:
main2.cpp: In function 'int main()': main2.cpp:16:11: warning: unused variable 'x' [-Wunused-variable] 16 | Test2 x; | ^ main2.cpp:18:11: warning: variable 'y' set but not used [-Wunused-but-set-variable] 18 | Test2 y = Test2{Test<double>{}}; |
People say just ignore it, but it's not feasible for my project. I've got lots of classes with this error that follow the same tag struct pattern. It's not reasonable to selectively disable this warning (I also find it useful in other circumstances).
How do I get the compiler to stop complaining about this? I should also mention that
Test2{Test<double>{},{}};
would not be an appropriate solution, as I have template code in use where some of the classes do not have this problem, and some do, which means this becomes an error in those circumstances.EDIT:
Note here is the example CMake used, which included the compiler options:
cmake_minimum_required(VERSION 3.13) project(test) set(CMAKE_CXX_STANDARD 17) set(CMAKE_C_STANDARD 11) add_executable(test main.cpp) target_include_directories(test PRIVATE ./ ) target_compile_options(test PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>: -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g -ggdb -O1>)
I'm also using mingw64-10.2
-
Did a Mac update ruin my ability to use gcc?
I am trying to compile two c files into one executable. In the directory I have only three files; Makefile, main.c and myfunction.c.
Makefile:
CC = gcc CFLAGS = -Wall -g -O0 LIBS = -lm SRCS = $(wildcard *.c) OBJS = $(SRCS:.c=.o) MAIN = main all: $(MAIN) @echo Program has been compiled $(MAIN): $(OBJS) $(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LIBS) clean: $(RM) *.o *~ $(MAIN)
main.c:
#include <stdio.h> void myfunc(); int main (int argc, char *argv[]) { myfunc(); return 0; }
myfunction.c:
#include <stdio.h> void myfunc() { printf("hello world"); }
output after make:
gcc -Wall -g -O0 -c -o main.o main.c gcc -Wall -g -O0 -c -o myfunction.o myfunction.c gcc -Wall -g -O0 -o main main.o myfunction.o -lm Undefined symbols for architecture x86_64: "_myfunc", referenced from: _main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [main] Error 1
I had something nearly identical working in the past. I have since clean installed MacOS and updated to Big Sur. Is this the issue or have I overlooked something?
-
PHP division adds a comma
I'm trying to convert cents to dollars (I don't need dollar sign, just value) but when I divide a number smaller than 100 by 100 I get a strange result.
Eg.: 1/100 give me 0,01.0
I don't need that comma, I need 0.01 as it should be.
I also tried number_format but it returns a string and when I cast the result to float I get the same strange value.
How can I fix it?
Thanks in advance for your help
This is the function I'm using:
public static function convertFromCents($value) { if(is_numeric($value)) { $value = $value/100; } else { $value = 0; } return $value; }
-
Scaling down block drawing without one block fighting to be two things
The code I lost in a hard drive failure however over a year later it still bugs me about it and I really want an answer so I can sleep at night without this popping into my head. So I was writing a defragmentation software and it displayed the clusters. The problem with the drawing code is floating point math. I'm not experienced enough to solve this math problem. I could draw the clusters no problem however due to floating point math the last pixel were fighting with the first pixel of a new cluster when I scaled it down to fit a window. I can't figure out how to prevent this. I tried rounding down and up but that left a pixel either empty or overwriting a pixel f the last cluster when it shouldn't be, etc. It should look like this. Can't figure out how this JkDefrag (open source) did it and I have the source code for it! This is what keeps me up at night. Please help me get a good nights sleep.
Drawing code from a backup:
void DrawTESTClusters( HWND hWnd, const CMemoryDC &memoryDC, LONGLONG ClusterStart, LONGLONG ClusterCount, int color ) { LONG Width; LONG Height; LONGLONG x1; LONGLONG y1; //LONGLONG x2; //LONGLONG y2; HDC hDC; LONG MaxLength; //DebugPrint(_T("%I64d - %I64d, %I64d\n"), ClusterStart, ClusterEnd, ClusterEnd - ClusterStart); // The usual checks if ( TotalClusters <= 0 ) // Can this happen ?? return; //_ASSERT( ClusterStart != ClusterEnd ); //if ( ClusterStart == ClusterEnd ) // Can this happen ?? // return; _ASSERT( ClusterStart >= 0 && ClusterStart <= TotalClusters ); //if ( ClusterStart < 0 || ClusterStart > TotalClusters ) // Can this happen ?? // return; //_ASSERT( ClusterEnd >= 0 && ClusterEnd <= TotalClusters ); //if ( ClusterEnd < 0 || ClusterEnd > TotalClusters ) // Can this happen ?? // return; _ASSERT( ClusterCount >= 0 && (ClusterStart + ClusterCount) <= TotalClusters ); hDC = memoryDC.GetMemoryDC(); Width = memoryDC.GetWidth(); Height = memoryDC.GetHeight(); MaxLength = memoryDC.GetMaxLength(); // Calculate some stuff float Scale = static_cast<float>(MaxLength) / TotalClusters; // TODO: Test this drawing code with scale above 1.0. // The current code should work in theory (to scale up) but if it doesn't the proposed fix-code below, commented: //if ( Scale > 1.0 ) // Scale = 1.0; LONG Length = static_cast<LONG>( ceil( static_cast<float>(ClusterCount) * Scale ) ); if ( Length <= 0 ) return; //LONG ScaleA = (ClusterStart * Scale / TotalClusters); //LONG ScaleB = (ClusterEnd * Scale / TotalClusters); //x1 = (double)(ClusterStart * Scale) / (double)Width; //x1 = (double)((double)ClusterStart / (double)Width) * Scale; //y1 = (ClusterStart * Scale) % Width; //y1 = fmod( (ClusterStart * Scale), Width ); //y1 = fmod( (double)ClusterStart / (double)Width), Scale ); //x2 = ScaleB % Width; //y2 = ScaleB / Width; x1 = static_cast<LONGLONG>( fmod( static_cast<float>(ClusterStart * Scale), static_cast<float>(Width) ) ); y1 = static_cast<LONGLONG>( static_cast<float>(ClusterStart * Scale) / static_cast<float>(Width) ); // Calculation done, now check if there is any point in drawing it //if ( x1 <= 0 && x2 <= 0 ) // return; // Save original object. HGDIOBJ oldPen = SelectObject( hDC, GetStockObject(DC_PEN) ); // Change the DC pen color SetDCPenColor( hDC, ClusterMapColors[ color ] ); //if ( InUse == 1 ) // SetDCPenColor( hDC, RGB(160, 160, 160) ); // 160 == 0xA0 //else if ( InUse == 0 ) // SetDCPenColor( hDC, RGB(0xFF, 0xFF, 0xFF) ); // //SetDCPenColor( hDC, RGB(0x00, 0x00, 0x00) ); //else if ( InUse == 2 ) // //SetDCPenColor( hDC, RGB(0x00, 0xFF, 0x00) ); // SetDCPenColor( hDC, RGB(0x00, 0x00, 0xFF) ); // Blue //else if ( InUse == 3 ) // //SetDCPenColor( hDC, RGB(0x00, 160, 0xFF) ); // SetDCPenColor( hDC, RGB(0x00, 0xFF, 0x00) ); // Green //else if ( InUse == 4 ) // //SetDCPenColor( hDC, RGB(0x00, 160, 0xFF) ); // SetDCPenColor( hDC, RGB(0xFF, 0x00, 0x00) ); // Red //else if ( InUse == 5 ) // Debug // SetDCPenColor( hDC, RGB(0xFF, 0xFF, 0x00) ); // Yellow //---------------------------------------------------- // Only Draw code in here LONG step; LONG line = static_cast<LONG>( y1 ); while ( Length > 0 ) { step = Min( Length, static_cast<LONG>(Width - x1) ); //step = Min( Length, Width ); if ( MoveToEx( hDC, static_cast<int>(x1), static_cast<int>(line), NULL ) ) LineTo( hDC, static_cast<int>(step + x1), static_cast<int>(line) ); Length -= step; x1 = 0; line++; } #if 0 Width = clientRect.right; Height = clientRect.bottom; int Scale = (Width * Height) / TotalClusters; //x2 = (ClusterEnd * Scale ) % Width; //y2 = (ClusterEnd * Scale ) / Width; // Start int startX = (ClusterStart * Width * Height / TotalClusters ) % Width; int startY = (ClusterStart * Width * Height / TotalClusters ) / Width; int endX = ; int endY; LONG Length = ClusterEnd - ClusterStart; while ( Length > 0 ) { LONG len = Min( Length, Width ); len -= startX; MoveToEx( hDC, startX, startY, NULL ); LineTo( hDC, startX + len, endY ); Length -= len; startY++; // Next line startX = 0; } #endif //---------------------------------------------------- // Restore original object. SelectObject( hDC, oldPen ); }
-
How to *reverse* JavaScripts DataView?
I understand this question is oddly phrased, so let me explain with 2 examples.
Example 1
The code below turns the series of values[64, 176, 0, 86, 68, 97, 136, 8]
into the float4096.336980910979
.(new DataView(new Uint8Array([64, 176, 0, 86, 68, 97, 136, 8]).buffer)).getFloat64(); /*Output 4096.336980910979*/
How do I reverse it to get the series of values
[64, 176, 0, 86, 68, 97, 136, 8]
when I input the float4096.336980910979
?Example 2:
The code below turns the series of values[70, 253, 192, 0]
into the float32480
.(new DataView(new Uint8Array([70, 253, 192, 0]).buffer)).getFloat32(); /*Output 32480*/
How do I reverse it to get the series of values
[70, 253, 192, 0]
when I input the float32480
? -
undefined reference error when building program using shared library that link static library
I built AWS WebRTC library as static library and made some shared library using it. As I understand, the static library should be included to the shared library if I make the shared library with the static library. But "undefined reference to ''" error(about the WebRTC library) happens if I build a program using the shared library.
Undefined reference error when building a program using the shared library
arm-linux-gnueabihf-g++ .obj/main.o -Wl,-rpath=/lib -Llibs -lpthread -lmysharedlib -o KeyWeDoorbell /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `getStateMachineCurrentState' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `mbedtls_x509write_crt_der' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `compareJsonString' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `initializeEndianness' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `mbedtls_x509_crt_parse_file' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `hashTableCreateWithParams' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `usrsctp_conninput' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `stackQueueRemoveItem' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `putInt32' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `lws_service' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `globalUnlockMutex' /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `onDataChannel' .... /home/jacob/Workspace/toolchain/arm-linux-gnueabihf/bin/ld: libs/libkeywe.so: undefined reference to `globalGetTime' collect2: error: ld returned 1 exit status
Build the shared library
arm-linux-gnueabihf-g++ -shared .obj/aws_webrtc_test.o -lpthread -Llibs -Bstatic -lkvsWebrtcClient -lkvsWebrtcSignalingClient -o mysharedlib.so
-------------------------- Edit ----------------------------
I tried to build a program that use the static library directly but it works well. So I thought it is because of Scope(PUBLIC/INTERFACE/PRIVATE) of target_link_libraries in the library CMakefile.
So I changed it like this
add_library(kvsWebrtcClient ${LINKAGE} ${WEBRTC_CLIENT_SOURCE_FILES}) target_link_libraries( kvsWebrtcClient PUBLIC kvspicUtils kvspicState ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${SRTP_LIBRARIES} ${Usrsctp} ${MBEDTLS_LIBRARIES} ${GPERFTOOLS_MALLOC_LIBRARIES} ${GPERFTOOLS_PROFILER_LIBRARIES} ${EXTRA_DEPS}) add_library(kvsWebrtcSignalingClient ${LINKAGE} ${WEBRTC_SIGNALING_CLIENT_SOURCE_FILES}) target_link_libraries( kvsWebrtcSignalingClient PUBLIC kvsCommonLws ${LIBWEBSOCKETS_LIBRARIES} kvspicUtils kvspicState ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_DEPS} ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${GPERFTOOLS_MALLOC_LIBRARIES} ${GPERFTOOLS_PROFILER_LIBRARIES} ${MBEDTLS_LIBRARIES})
But it is the same. Is there anyone who know how to fix it?
-
Real world DRAM write only application
I am eager to know if there is any real world application which includes following scenario:
Megabytes of continuous write-only to DRAM simultaneously from all (three or more) A53 cores (or any other Arm cores) – throughout the application as the only operation from the core.
The reason why I am asking is, I came accross a specific scenario while designing a chip in which the above operation is misbehaving, so would like to explore how to handle this specific scenario if it's valid.
I could think of only DRAM initialisation.
-
Why this function does point to itself with a offset of 1?
I'm trying to write a bare metal blink program for a Nucleo-64 Stm32F401re board using C. However while starting debugging for errors (it didn't blink yet) I found an odd adress for which I found no explanation. This is the output of the relevant part of the disassembly:
blink.elf: file format elf32-littlearm Disassembly of section .text: 08000000 <isr_vector_table>: 8000000: 20018000 andcs r8, r1, r0 8000004: 08000009 stmdaeq r0, {r0, r3} 08000008 <Reset_Handler>: 8000008: b480 push {r7} 800000a: af00 add r7, sp, #0 800000c: bf00 nop 800000e: 46bd mov sp, r7 8000010: bc80 pop {r7} 8000012: 4770 bx lr Disassembly of section .ARM.attributes: 00000000 <.ARM.attributes>: 0: 00002d41 andeq r2, r0, r1, asr #26 4: 61656100 cmnvs r5, r0, lsl #2 8: 01006962 tsteq r0, r2, ror #18 c: 00000023 andeq r0, r0, r3, lsr #32 10: 2d453705 stclcs 7, cr3, [r5, #-20] ; 0xffffffec 14: 0d06004d stceq 0, cr0, [r6, #-308] ; 0xfffffecc 18: 02094d07 andeq r4, r9, #448 ; 0x1c0 1c: 01140412 tsteq r4, r2, lsl r4 20: 03170115 tsteq r7, #1073741829 ; 0x40000005 24: 01190118 tsteq r9, r8, lsl r1 28: 061e011a ; <UNDEFINED> instruction: 0x061e011a 2c: Address 0x0000002c is out of bounds.
The Reset_Handler function itself is on the right adress but by using its name as pointer in the code it points one adress further! Here is the corresponding code:
extern int _stack_top; // bigger Memory Adress void Reset_Handler (void); __attribute__((section(".isr_vector"))) int* isr_vector_table[] = { (int*)&_stack_top, (int*)Reset_Handler }; void Reset_Handler (void) { }
And the Linker script I used which is basically the same used in most tutorials.
OUTPUT_ARCH(arm) OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") ENTRY(Reset_Handler) MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 96K } _stack_top = ORIGIN(SRAM)+LENGTH(SRAM); SECTIONS { .text : { . = ALIGN(4); *(.isr_vector) *(.text*) *(.glue_7) *(.glue_7t) *(.eh_frame) KEEP(*(.init)) KEEP(*(.fini)) . = ALIGN(4); _etext = .; } > FLASH .rodata : { . = ALIGN(4); *(.rodata*) . = ALIGN(4); } > FLASH .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH .ARM : { __exidx_start = .; *(.ARM.exidx*) __exidx_end = .; } >FLASH .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >FLASH .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >FLASH .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >FLASH . = ALIGN(4); _sidata = LOADADDR(.data); .data : { . = ALIGN(4); _sdata = .; *(.data*) . = ALIGN(4); _edata = .; } > SRAM AT > FLASH .bss : { . = ALIGN(4); _sbss = .; __bss_start__ = _sbss; *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; __bss_end__ = _ebss; } > SRAM /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } .ARM.attributes 0 : { *(.ARM.attributes) } }
So why the adress stored in the isr_vector_table is 08000009 and not 08000008? The only way I so far could change it to the right value was through hardcoding the value or defining a extra section for the Reset_Handler so I could use the adress as another extern value like the _stack_top.
Here are the commands I used for compilation as I don't know if they are necessary to find an answer:
cd C:/bare_metal arm-none-eabi-gcc.exe -g main.c -o blink.elf -Wall -T STM32F4.ld -mcpu=cortex-m4 -mthumb --specs=nosys.specs -nostdlib -O0 arm-none-eabi-objdump.exe -D blink.elf
-
why am I getting a precise bus fault exception (PRECISERR) on what looks like a perfectly fine aligned access (cortex-m7)
I'm getting a HardFault that results from a forced/escalated Precise Bus Fault Exception, as indicated by the
PRECISERR
bit in theBFSR
register, and I can't seem to figure out why it is occurring. The exception occurs from within vendor-supplied startup code that previously executed fine, and I cant see any alignment or memory-related issues.The offending instruction is
ldrlt r0, [r1], #4
on the first iteration through the loop, where the value stored inr1
is0x00040458
The full instruction sequence is shown below, where other relevant symbols used in
r2
andr3
are defined in the comments/* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script. * __etext: End of code section, i.e., begin of data sections to copy from. * __data_start__/__data_end__: RAM address range that data should be * __noncachedata_start__/__noncachedata_end__ : none cachable region * copied to. Both must be aligned to 4 bytes boundary. */ ldr r1, =__etext /* equal to 0x00040458 */ ldr r2, =__data_start__ /* equal to 0x20000000 */ ldr r3, =__data_end__ /* equal to 0x20000224 */ .LC0: cmp r2, r3 ittt lt ldrlt r0, [r1], #4 /* <---- exception triggered here */ strlt r0, [r2], #4 blt .LC0
The offending address listed in
BFAR
is0x00040458
, which corresponds to the value inr1
and is a perfectly valid 32-bit aligned address within the ITCM region (0x0 --> 0x0007FFFF).Not sure what else could be causing this exception if the memory access itself looks fine. The exception was introduced by expanding the
.text
section in my linker file, as shown belowMEMORY { m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400 m_text (RX) : ORIGIN = 0x00000400, LENGTH = 0x00074000 /* changed from LENGTH = 0x0003FC00 */ m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000 m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00020000 }
If it isn't an alignment issue, I'm not sure what it could be? But
0x00040458
is most definitely word-aligned, as is0x0004045C
which results from the#4
offset to theldr
instruction.Also, why is
0x0004045C
not shown inBFAR
, since the cortex-m7 TRM says theldr
instruction applies the offset to the target register value before the memory access occurs??Full exception registers shown below for completeness
-
How to change exception priority on cortex-m4 processor in Rust?
I want to set interrupt priorities for processor internal exceptions. The
cortex_m
crate provides easy access to NVIC control registers. Specifically, there is a method that let me set priority for each interrupt.let mut p = cortex_m::Peripherals::take().unwrap(); p.NVIC.set_priority(...);
set_priority
asks me to pass an argument specifying for which interrupt I intend to modify the priority. Say I want to change the priority forPendSV
. However, passing incortex_m::peripheral::scb::Exception::PendSV
will not work because it does not implement a required trait bound.I am developing on STM32F407VGT6 board, so I also looked in the
stm32f4
crate, but I did not find any enum definition that can help either.Should I write my own enum that implements the required trait so that it can specify interrupt numbers, or is there already some existing crate that can make it work?
-
GCC Not finding builtin memcpy
I am doing work on a ARM cortex-m MCU using the arm-none-eabi version of gcc. I am also using
-fnostdlib
and-fnostdin
.In my code I am using
memcpy
andstrlen
. Both of these functions are builtin function as per the gcc manual. When I use these function as is or as__buitin_...
, I getundefined reference to ...
.Why is gcc not generating the code as expected?
-
Why there is only libgcc.a?
I am currently build my own gcc/g++ tools, and I find there is only libgcc.a, but no libgcc.so.
Why does this happen, and can I dynamicly link libgcc?
-
apt get update is posting an error while using debian source
my dockerfile is as below:
FROM wordpress:5.5.1-php7.4 RUN echo 'deb http://ftp.us.debian.org/debian sid main' >> /etc/apt/sources.list RUN apt-get update && \ apt-get install -y wget sudo && \ apt-get install -y ssmtp
Did not run a build for the past few months and now I am getting the below error while building
Step 20/45 : RUN echo 'deb http://ftp.us.debian.org/debian sid main' >> /etc/apt/sources.list ---> Running in bded7d792d7e Removing intermediate container bded7d792d7e ---> 241596b3bdc2 Step 21/45 : RUN apt-get update && apt-get install -y wget sudo && apt-get install -y ssmtp ---> Running in 4870366692cf Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB] Get:2 http://deb.debian.org/debian buster InRelease [121 kB] Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB] Get:4 http://ftp.us.debian.org/debian sid InRelease [146 kB] Get:5 http://security.debian.org/debian-security buster/updates/main amd64 Packages [243 kB] Get:6 http://deb.debian.org/debian buster/main amd64 Packages [7906 kB] Get:7 http://ftp.us.debian.org/debian sid/main amd64 Packages [8492 kB] Get:8 http://deb.debian.org/debian buster-updates/main amd64 Packages [7856 B] Fetched 17.0 MB in 3s (6517 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: libc6-dev : Breaks: libgcc-8-dev (< 8.4.0-2~) but 8.3.0-6 is to be installed E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. The command '/bin/sh -c apt-get update && apt-get install -y wget sudo && apt-get install -y ssmtp' returned a non-zero code: 100 ##[error]The command '/bin/sh -c apt-get update && apt-get install -y wget sudo && apt-get install -y ssmtp' returned a non-zero code: 100 ##[error]The process '/usr/bin/docker' failed with exit code 100
I tried removing the gcc completely but no luck.. tried with multiple other debian sources too but no luck,, Anyone faced a similar issue??