Weird Crash While Casting 4 Byte Data Array To Uint32_t #4330 - GitHub

Skip to content Dismiss alert {{ message }} / Arduino Public
  • Notifications You must be signed in to change notification settings
  • Fork 13.3k
  • Star 16.5k
  • Code
  • Issues 324
  • Pull requests 75
  • Discussions
  • Actions
  • Projects
  • Wiki
  • Security

    Uh oh!

    There was an error while loading. Please reload this page.

  • Insights
Additional navigation options Weird crash while casting 4 byte data array to uint32_t #4330New issueNew issueClosedClosedWeird crash while casting 4 byte data array to uint32_t#4330@alieslam

Description

@alieslamalieslamopened on Feb 8, 2018

Basic Infos

Hardware

Hardware: Wemos D1 mini Core Version: 2.4.0

Description

Attached bellow a sketch were i am trying to cast a 4 byte data array to a 32 bit integer, but the system crashes. PS: Sketch contains .cpp and .h files

Settings in IDE

Module: ESP8266 Module Flash Size: 4MB CPU Frequency: 80Mhz Flash Mode: ?qio? Flash Frequency: ?40Mhz? Upload Using: SERIAL Reset Method: ?ck / nodemcu?

Sketch

Sketch has multiple files. Main

#include "test.h" My_Class test; void setup() { Serial.begin(256000); Serial.println("Start"); printf("%p \n",test.data); printf("%p \n",test.getDataPointer()); uint32_t temp = *((uint32_t *) test.getDataPointer()); Serial.println(temp); } void loop() { }

test.cpp file

#include "test.h" uint8_t * My_Class::getDataPointer() { return data; }

test.h file

#ifndef test_h #define test_h #include <Arduino.h> #include <string.h> class My_Class{ public: uint8_t * getDataPointer(); bool isValid; uint8_t data[4]={0x00,0x00,0x00,0x20}; }; #endif

Debug Messages

2/8/2018 19:05:20.829 [RX] - ÀüÀ<<<<NUL>�À<<<NUL>�À<<NUL>�ü<ü<<NUL>�<À<À<NUL>�À<NUL>�<üÀ<NUL>�À<À<NUL>�ÀÀÀ<À<NUL>�À<NUL>�À<NUL>�<<NUL>�À<NUL>�ü<<<ü<À<ÀüÀÀ<NUL>�À<NUL>�üÀ<NUL>�<<NUL>�ÀÀÀ<ü<ü<üü<À<ÀÀüÀ<NUL>�À<<NUL>�À<<NUL>�ü<<NUL>�<Àü<ü<À<NUL>�À<<NUL>�À<ü<NUL>�<ü<<<À<<<üü<À<NUL>�À<NUL>�<ÀÀ<NUL>�À<ü<NUL>�À<ü<NUL>�<À<<<üü<À<NUL>�À<NUL>�<ÀÀ<NUL>�À<ü<NUL>�À<Àü<üÀü<NUL>�<<<<NUL>�<<NUL>�<<<<NUL>�<ÀÀ<<NUL>�À<À<ü<À<<Start<CR><LF> 0x3ffee999 <LF> 0x3ffee999 <LF><CR> <LF> Exception (9):<CR><LF> epc1=0x4020208f epc2=0x00000000 epc3=0x00000000 excvaddr=0x3ffee999 depc=0x00000000<CR><LF> <LF> ctx: cont <LF> sp: 3ffef840 end: 3ffefa10 offset: 01a0<CR><LF> <LF> >>>stack>>><LF> 3ffef9e0: feefeffe 3ffee998 3ffee9bc 40202088 <CR><LF> 3ffef9f0: 3fffdad0 00000000 3ffee9d8 40202514 <CR><LF> 3ffefa00: feefeffe feefeffe 3ffee9f0 40100108 <CR><LF> <<<stack<<<<LF>

Metadata

Metadata

Assignees

No one assigned

Labels

No labelsNo labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You can’t perform that action at this time.

Tag » Arduino Uint32_t To Byte Array