408,224 questions
-3
votes
0
answers
47
views
VS Code + MinGW: "exit code: 1" compiling multiple .c [closed]
I'm trying to compile a C project in VS Code that has two files: EjercicioC.c (which has main()) and funciones.c (which has helper functions).
When I try to build, it only compiles EjercicioC.c and ...
Advice
0
votes
2
replies
44
views
How to run and test Software Code and then put it in Hardware
I'm trying to build my own handheld games console similar to a gameboy.
Currently for the POC im using the Arduino Uno, seperate SD Card Reader Module and 2.4 inch TFT Display. I want to put the game ...
9
votes
1
answer
338
views
Compiler interpretation of '____'
I have found a piece of code that defines register access permissions for a chip. Using arm-none-eabi-gcc it compiles correctly.
Here is the code:
static const uint8_t defaultRegisterAccess[...
2
votes
1
answer
62
views
Macros not working as I expect on Windows
I have the below code I want to print Use skeleton! if SKELETON_ENABLED is defined and is not running on MAC OS, and Don't use skeleton!\n otherwise.
The program prints Don't use skeleton!\n, even ...
2
votes
0
answers
52
views
Optimized Assembly Generation for Unsigned Multiplication Leads to Unexpected Result for Cortex-M0+
I was experimenting with some fixed-point arithmetic on the Cortex-M0+ in Godbolt's compiler explorer and came across an interesting behaviour with respect to the optimisation of a multiplication ...
0
votes
0
answers
26
views
STM32 - I2S: Read signal from INMP441
I'm using STM32F103C8T6 to receive the signal from INMP441 with I2S. Using Standard Periph Library with keilC. I configured GPIO, I2S, Usart, I want to get data from INMP441 then send it to esp32 ...
1
vote
1
answer
145
views
Encounter a problem that print wide_character in C
Here is my code:
#include "snake.h"
void SetPos(short x, short y)
{
//获得标准输出设备的句柄
HANDLE houtput = NULL;
houtput = GetStdHandle(STD_OUTPUT_HANDLE);
//定位光标的位置
COORD pos =...
Advice
0
votes
4
replies
94
views
Using lockless atomic operations instead of a mutex
I recently had an interview where I was asked to show how to prevent race conditions in C or C++ between two threads operating on shared data. I used a mutex as follows :
pthread_mutex_t mutex;
int ...
3
votes
0
answers
72
views
Cross-compiling GLIBC for ARM
I am tying to cross-compile GLIBC_2.36 from source for ARM. I am using arm-linux-gnueabihf toolchain to do this. The command I am passing from my build directory is below:
../glibc-2.36/configure --...
Best practices
0
votes
10
replies
196
views
How to tell the C compiler that data pointed to by a pointer won't be constantly modified by another thread after being passed to a function?
In C, when I pass a pointer to a function, the compiler always seems to assume that the data pointed to by that pointer might be continuously modified in another thread, even though in actual API ...
2
votes
0
answers
37
views
I can't figure out why my stm32 spi peripheral is not working
So i am learning the stm32f103c8t6 board, and after having used the hal, i am trying to create my own peripheral driver, but i can't seem to get the spi working, I am trying to communicate with an spi ...
-4
votes
1
answer
81
views
Is the GCC bootstrapping 'chain' improved / simplified relative to 2021?
In 2021, this post here on StackOverflow:
How are GCC and g++ bootstrapped? -> Andrius Strikonas' answer
explained how GCC can be bootstrapped beginning with a tiny assembler taking just a hex dump ...
2
votes
0
answers
47
views
How to display a label as message window in Motif MainWindow
I want to use the Motif MainWindow using:
A container as work region
A label as message window.
But the label is not shown.
My expectation is that it would be shown below the container (work region)....
3
votes
1
answer
106
views
How to create a dialogbox main window in C using Visual Studio 2022?
I just installed Visual Studio 2022 and I'm trying to get an application working with a dialog box as a main window in order to make the GUI easier to produce. But the thing is that I've found nothing ...
-3
votes
1
answer
144
views
How does fgets work when reading a file or stdin? [closed]
I'm following the Bro Code course of C and there's something I'm not fully understanding. This might be a basic question, but I can't figure out what is going on behind the function fgets.
When ...