embedded

Auto baud rate detect for STM32L0

江枫思渺然 提交于 2019-12-10 14:55:51
问题 I can't get auto-baud rate detection to work on the STM32L0 . I'm using the hardware abstraction layer (HAL). My initilization code is: /* USART1 init function */ void MX_USART1_UART_Init(void) { huart1.Instance = USART1; huart1.Init.BaudRate = 300; huart1.Init.WordLength = UART_WORDLENGTH_9B; huart1.Init.StopBits = UART_STOPBITS_1; huart1.Init.Parity = UART_PARITY_EVEN; huart1.Init.Mode = UART_MODE_TX_RX; huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart1.Init.OverSampling = UART

How do I declare a static variable as a reference to a hard-coded memory address?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 14:40:11
问题 I am working on embedded Rust code for LPC82X series controllers from NXP - the exact toolchain does not matter for the question. These controllers contain peripheral drivers in ROM. I want to use these drivers, which means I need to use unsafe Rust and FFI without linking actual code. The ROM APIs expose function pointers packed into C structs at specific address locations. If somebody wants the details of this API, chapter 29 of the LPC82X manual describes the API in question. My Rust

How can I fill an S-record with two byte values starting on even address boundaries?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 14:20:32
问题 When I compile my code I eventually get Motorola S records ( a.mot ) with gaps (the whole address range is not covered by code and data). I want to fill those gaps with the pattern 0x01 0x80 . However, it is important that all of the two-byte pairs must start at even addresses. 0x0180 is an opcode from my micro that I want to be executed if the PC reaches an address of unused flash area. Before you start answering I'd like to tell you that -repeat-data in srec_cat has an issue: Given two

Initializing a variable and specifying the storage address the same time: is it possible?

故事扮演 提交于 2019-12-10 13:59:09
问题 In the codevision compiler for Atmel processors, there is a possibility to specify the storage address of a global variable, for example int a @0x100; // will place the variable at the address 0x100 in RAM Of course, as per standard C, variables can be initialized upon declaration int a=42; However, I did not find any possibility to do them both. int a @0x100 = 42 or int a = 42 @0x100; don't work, they cause compiler errors. You might ask why it is so important to do it, because one could

Embedded code development (especially for PIC with C18) in Visual Studio

為{幸葍}努か 提交于 2019-12-10 13:57:27
问题 I'm using Visual Studio for writing desktop applications, and I find it very user friendly and easy to use. If possible, I also want to write embedded code in Visual Studio. For example, is it possible to generate .hex files for PIC18Fxxx series with C18 or any other similar C-based language? 回答1: Unfortunately, there is no official support for PIC by Visual Studio. And, I didn't ever hear that someone has made this in an "unofficial" way. There have always been rumors and speculations about

Pointer to function in ROM

廉价感情. 提交于 2019-12-10 13:54:33
问题 I have microcontroler that I am working with. When debugging it is necessary to call a function from that is hard coded in ROM. Technical Reference shows how to do this: # define Device_cal (void(*)(void))0x3D7C80 and calling procedure looks like this: (*Device_cal)() I can't understand what actually happens here, so my question is: How does it work? 回答1: The #define causes (*Device_cal)() to be expanded into this immediately before compiling: (*(void(*)(void))0x3D7C80)() The void(*)(void) is

Bare metal without global operator new

混江龙づ霸主 提交于 2019-12-10 13:53:44
问题 Consider safety software, where dynamic allocation in general is disallowed and exceptions are disallowed. Dynamic allocation is allowed only when class explicity defines operator new and delete . Using operator new for others class should cause compilation failure. The simplest way to cause compilation failure in described situation is to remove global new operator: void* operator new(std::size_t) = delete; On the one hand this cause side effects with standard library. For example including

Where can I find a simple graphics C library for writing directly onto a frame? [closed]

 ̄綄美尐妖づ 提交于 2019-12-10 13:46:48
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I need a simple graphics C library to use on a device where I will be writing directly to the frame. The frame is located in regular memory. There is no graphics acceleration hardware. Nothing fancy. I just want to be able to draw lines, circles, OSD stuff like strings as well. It would be nice to have functions

Build a makefile dependency / inheritance tree

人盡茶涼 提交于 2019-12-10 13:33:08
问题 Apologies if I explain this badly or am asking something bleeding obvious but I'm new to the Linux kernel and kinda in at the deep end... We have an embedded-linux system which arrives with a (very badly documented) SDK containing hundreds of folders of stuff , most folders containing a rules.make, make, make.config or some variation of... and the root folder containing a "master" makefile & rules.make which mean that you can, from the root folder, type "make sysall" and it builds the entire

FreeRTOS: osDelay vs HAL_delay

一曲冷凌霜 提交于 2019-12-10 13:31:09
问题 While creating FreeRTOS application project with STM32CubeMx , there are two ways you can use to introduce delay, namely osDelay and HAL_Delay . What's the difference among them and which one should be preferred? osDelay Code: /*********************** Generic Wait Functions *******************************/ /** * @brief Wait for Timeout (Time Delay) * @param millisec time delay value * @retval status code that indicates the execution status of the function. */ osStatus osDelay (uint32_t