Open anijjar opened 4 years ago
Here is a txt file with the powerboard firmware pwer board firm.txt
With regard to Jetson Monitor/serial_manager.cpp lines 74 and 75: '65536ul' is meant to be defining the size passed in to the readline function (to be 16 bits unsigned long). However 2^16 -1 is 65535 and not 65536. I would use uint16_t instead.
However, if you look at the actual readline method in wjwwood's serial.cc implementation you can see that the buffer used in that function is a character array. And that the size var that is passed in is the size of the length of that array. ie how many char it should be. Not the size in bits.
Anyway, the readline function just reads until it finds the eol character. But it is obviously kinda bad because it's allocating memory for a buffer of 65536 characters. 65KB.
This 65536ul size is also being used in power_board.cpp on line 68.
Line 75 is just finding the result of a comparison and storing that bool in device_found.
Right, I understand line 75 after I found some random line of code somewhere on github. I think you are on to something, Lets change that section tommorow at the meeting. @robwasmann
I don't think it would make anything crash to allocate the 65K, but we can try changing it anyway to something more reasonable.
Background: The Powerboard will not connect with the jetson.
[x] PB UART test with Tera Term: Entering the commands "RID" and "RBxyyy" produced expected results ("Power_Board" and "ACK"). The firmware is not the issue
[ ] Jetson Monitor/serial_manager.cpp: Lines 74 and 75 seems like a cause for concern. line 74 contains '65536ul' as a parameter, but i am unsure what it means; line 75 uses syntax i havent seen before in c++. More info on the readline command can be found on @wjwwood/serial/serial.cc. A method to debug is to use ROS_DEBUG and check either the logs at ~/.ros/log or the /rosout topic using rostopic echo rosout to view it in a console.