embedded

sprintf buffer global data overflow - how to detect it, Windows

安稳与你 提交于 2019-12-11 07:37:31
问题 I am wondering if it's possible to detect this kind of buffer overflow somehow in Windows. Buffer is global ( not on stack ) so /RTC in Visual Studio 2008, VS2012 is not checking it. MinGW gcc also failed. #include <stdio.h> char buffer[2]; void main() { sprintf(buffer,"12345"); } My first thought was static analysis. VS2012 Code Analysis : nothing CppCheck: nothing PCLint Online: nothing ( http://www.gimpel-online.com/OnlineTesting.html ) PVS-Studio: nothing another solution is to use _s

C - Cannot access memory at address

佐手、 提交于 2019-12-11 06:43:56
问题 When debugging GDB tells me the following error: 0x800c99ed00000001 < error: Cannot access memory at address 0x800c99ed00000001> The error is produced if I put a breakpoint when I call ConvertByteArrayToFloat while debugging . But the program exits without a problem and gives me an Ok result ? My main file: #include "Local.h" int main(void) { if(HandleReceivedMessages() == OP_COMPLETED){ printf("Main Completed \n" ); } else { printf("Main Failed \n"); } return 0; } Local.h #ifndef LOCAL_H_

let me know the following regarding USB Modem plugin & plug out notification handler APIs or system calls in Linux

醉酒当歌 提交于 2019-12-11 06:28:16
问题 Please let me know the following regarding USB Modem plugin & plug out notification handler APIs or system calls in Linux : In my application I have to write a function which will receive notifications in the following scenarios : When a USB Modem is plugged in, I would like to receive a notification that a USB Modem is plugged in, any Linux system call or Linux kernel API is there to send these notifications, also along with notification if I receive additional information about that device,

Integer and boolean types to use in an embedded system with two architectures

烂漫一生 提交于 2019-12-11 05:53:12
问题 I'm writing some software for an embedded system, mostly in C. It happens to be a dual core TI platform and I am using a few vendor and other libraries. The processor has one ARM core which is 32-bit and can do byte access ( sizeof(char) == 1 and sizeof(int) == 4 : 8 and 32 bits respectively) and one C28 core which is a 32-bit CPU with sizeof(char) == sizeof(int) == 1 : both are 16-bits (yes, really). I plan to avoid types such as int and char in favour of always being explicit about what I

How to use Inline Assembly with MPLAB C18?

元气小坏坏 提交于 2019-12-11 05:47:34
问题 I am using MPLAB C18 which provides an internal assembler to enable calling assembly functions from a C project. I am following the rules on how to use Inline Assembly and I suspect something about ' Full text mnemonics must be used for table reads/writes ' is causing a syntax error message upon building my project. The internal assembler differs from the MPASM assembler as follows: No directive support Comments must be C or C++ notation Full text mnemonics must be used for table reads/writes

How to fix a "[Lp002]: relocation failed with IAR ARM tools?

人走茶凉 提交于 2019-12-11 05:38:59
问题 I created a small module in assembler for ARM, to be linked together with my bare-metal embedded application. Sometimes when I'm rebuilding the application, I get a "Error[Lp002]: relocation failed: valued out of range or illegal". What is even more puzzling is that I'm getting the error after commenting out some code in a C module. The IAR manual is vague about 're-ordering the section or the code.' But looking at the assembler files generated by the compiler from my .c files, I see no

Embedded linux filename length

烂漫一生 提交于 2019-12-11 05:09:38
问题 I am using an arm development platform. There I installed udev and it works perfect. But when I mount a pen drive and see the file content all files and folders with names having more than 8 chars have been replaced with "~" char. eg: myfilename.mp3 is replaced with myfile~e.mp3 Before udev installation it worked well. (All file names appeared normally). What should I do? thank you. 回答1: This is not related to filename length limitation in Linux. This happened because this drive was mounted

Which datatype is better in calculation of CRC16 for any type of file

夙愿已清 提交于 2019-12-11 05:08:13
问题 Here i am using two different functions for calculating CRC16 for any type of file (.txt,.tar,.tar.gz,.bin,.scr,.sh etc) and different size also varies from 1 KB to 5 GB . I want to achieve this `cross platform less time consuming Have to work proper for any type of file and any size` i got same value of CRC in both functions. but any one can tell me which one is more better to calculate CRC16 for any type of file with any size on different different platform. Here we have to consider 0 to

Stdio/Stdlib still linking after passing -ffreestanding and -nostdlib flags to linker

橙三吉。 提交于 2019-12-11 04:42:57
问题 I'm trying to compile a bare metal application for an ARM c Cortex-M3 processor and I'm having trouble setting up the compiler/link flags. I'm on Ubuntu Trusty, using arm-none-eabi-gcc compiler 4.9.3 20150529. Here is my main.c: #include <stdio.h> void main() { printf("Hello, world"); } // Tons of clock initialization code ... And here is the generated link command: arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -mlittle-endian -g -ggdb -T /home/user/hello-arm/cmake/../ldscripts/STM32F100XB_FLASH

Is it possible to set ISR Handler at runtime on M0+

醉酒当歌 提交于 2019-12-11 04:37:48
问题 I have a "default" resetVectors.c file for my SAMD21 ARM M0+. It has something that looks like: __attribute__ ((section(".vectors"))) const DeviceVectors exception_table = { ... }; in it that defines where different handler stubs. For testing purposes, I want to use one of the unused peripheral IRQs. By default, the unused ones are set to NULL addresses. I have demonstrated to myself that I can modify that file and at compile time change my unused IRQ (21) to fire a handler. BUT, is it