|
Short reply - same code runs on RPi 3B , perhaps swapping SD between 3B an Zero is not a good idea. But in theory the OS should be smart enough to know what hardware it is running on. I'll try clean OS install on Zero next.
|
|
|
|
|
Would you take the boot drive out of a PC and expect it to be able to run inside a different model PC without problems?
I don't think so.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Too simplified reasoning.
I am pass evaluating OS , I believe the issue is how GCC interacts with TCF in ARM6.
It has been established that RPi 0 an 1 are using ARM6 and RPi 2 and up are using ARM 7.
ARM6 "code" will run on ARM7, but ARM7 will not run on ARM6.
My code runs fine on ARM7, but not on ARM6. Exactly opposite expectations.
I did verify that TCF was build for ARM6 , but it is failing on ARM6 processor- where is should be "native".
The whole point of this troubleshooting is to find out - at lest in theory, what is happening.
I am in process of comparing compilation outputs on ARM6 versus ARM7.
I have not figured out how to verify / debug the running TCF code on either processor. It is little time consuming process keep switching between RPi's.
But I do appreciate any input to help solve this.
|
|
|
|
|
Richard .. It is trivial I do it all the time even in baremetal.
That is a bit like saying 386 code should not run on 486, 586, 686 etc
Val I do the change SD card from Pi1,Pi2, Pi3, Pi ZeroW every day of week it is not an issue.
My zero's for example don't have a screen I have to put the SD card into a 2 or 3 to edit configs.
I would also add the Raspbian install image doesn't ask you what model you are on or have different installs
Throw what you are doing up on Github or a website Val and I will have a look and sort it out.
Anything you compile for ARM6 should definitely work on any ARM7/ARM8 model Pi so long as you deal
with the couple of small differences if you start poking registers.
In vino veritas
modified 23-Nov-18 3:58am.
|
|
|
|
|
Leon,
sorry for late reply.
Here is (another) short update .
I may have already said that the only option for crosscompliing is the "prefix"
arm-linux-gnueabihf so this may be dupe.
With that "prefix" the crosscompiler comes up with -march=arm7...
So I added -march=armv6 ( for Zero) and got this
/usr/arm-linux-gnueabihf/include/c++/5/exception:63:39: sorry, unimplemented: Thumb-1 hard-float VFP ABI
exception() _GLIBCXX_USE_NOEXCEPT { }
^
src/subdir.mk:18: recipe for target 'src/Zero.o' failed
Adding -marm gets rid of the problem. I did briefly check what -marm option does and it is related to some switching between things.
Unimportant at this time - I just wanted clean compile.
The "bottom line" _ I can actually run Eclipse and in "debug" perspective I get
"TCF Agent disconnected ' Permission denied. "
I have seen this error long time ago when I started with TCF - turned out to be related to running "TCF Agent " as root.
BUT TCF Agent runs in root as default while using RPi 3B - so the problem MUST be somewhere else.
BTW I am having heck of time using " newest and greatest Eclipse "
I would like to try some other C++ IDE to run in crosscompile / TCF mode instead of Eclipse.
Cheers and thanks.
|
|
|
|
|
OK, here is the latest.
I compile C++ code for armv6 and run ( identical ) TCF Agent software ( the latest) on Raspberry Pi 3B and it works. Produce “hello word” output.
Same setup fails on Raspberry Pi Zero. No output whatsoever.
The ONLY difference is - I select appropriate WiFI connection for each hardware - on Eclipse TCF configuration - swapping Agent IP ! Same WiFi configuration !
( Yes, I have BOTH RPi powered and running )
At this point I have exhausted pretty much all software options.
I am open to suggestions - one being "ditch Zero"
|
|
|
|
|
One more to discuss.
To crosscompile C++ code I specify this "prefix"
arm-linux-gnueabihf
Already beaten to death.
The output from both "cross" compiler and linker only reference to hardware is "arm7".
After reading up on how crosscomplier works - there shoudl be "--host","--build" and " --target" options to specify (what ? OS / hardware ?) somewhere. There are none!
The only one is - as mentioned - the "magical " arm7.
|
|
|
|
|
OK, I was wrong
Here is what is in output - both compiler and linker
--build=x86_64-linux-gnu --host=x86_64-linux-gnu –target=arm-linux-gnueabihf
This is what I am reading ( into it) - in English
"build" C++ code ( on OS (?)
x86_64-linux-gnu )
"host" is OS(?)
x86_64-linux-gnu
and "host" does what ?
and the code will run on "target "
arm-linux-gnueabihf
So where is the "target" (armv6l) (?) specification - hardware , OS , etc . ?
Am I finally asking right questions?
Do I need better terminology ?
Would it help to post the entire output?
|
|
|
|
|
Hi every one. I have typical structure (ECU_t) which has members that considered to be pointer to struct.
i make my question in comments. please help me. by the way i have used freescale code warrior as compiler.
typedef enum
{
NORMAL,
WARNING,
}WATER_TEMP;
typedef struct
{
WATER_TEMP water_temp;
uint16_t speed;
}Engine_t;
typedef struct
{
Engine_t* engine;
ABS_t* abs;
}ECU_t;
void ECU_DoTask(ECU_t* output)
{
output->engine->water_temp = NORMAL;
}
void main ()
{
ECU_t ecu;
ECU_DoTask(&ecu);
while(1);
}
|
|
|
|
|
your remarks show the correct way to access the variable, but (and it is a big 'but') the memory for the pointed struct must be first allocated. try
int main ()
{
ECU_t ecu;
ecu.engine = (Engine_t *) malloc(sizeof(ecu.engine)); ECU_DoTask(&ecu);
printf("water_temp = %d\n", ecu.engine->water_temp);
free( ecu.engine);
return 0;
}
|
|
|
|
|
Each structure inside is a pointer and needs to be allocated and even worse this is inherently dangerous because
any of those pointers could be NULL if an error occurred and that line will crash.
output->engine->water_temp = NORMAL;
What you are building is a database and as the entries are small there is no advantages to allocation and pointers,
you only do pointers if the data is going to be large. Just place the structure in as is.
typedef enum
{
NORMAL = 0,
WARNING = 1,
} WATER_TEMP;
typedef struct {
WATER_TEMP water_temp;
uint16_t speed;
} Engine_t;
typedef struct
{
Engine_t engine;
} ECU_t;
int main(void)
{
ECU_t ecu_test = { .engine.water_temp = NORMAL,
.engine.speed = 10 };
printf("Water temp is %i\n", ecu_test.engine.water_temp);
printf("Engine speed is %i\n", (unsigned int)ecu_test.engine.speed);
}
In vino veritas
|
|
|
|
|
thank you. but i want to create a function with form of:
void ECU_DoTask(ECU_t* out_ecu)
{
}
because i should pass the values of ecu parameters as an output argument of function. so i need use pointers.
|
|
|
|
|
You are missing the point nothing I have done stops you using pointers on the interface
In my code above you could do
static ECU_t ecu_test;
ECU_DoTask(&ecu_test);
Or you could do this
ECU_t* ecu_test = malloc(sizeof(ECU_t));
ECU_DoTask(ecu_test);
However none of that has anything remotely to do with what is in the structure and removing the pointers
and internally you have no way to know how I did the allocation externally
I think what has thrown you is me creating one of your structures without having to create it like
you want, but that is just me being tricky with C literals to give you something to test.
In vino veritas
modified 19-Nov-18 20:25pm.
|
|
|
|
|
Why bother making Engine_t and ABS_t pointers? Just make them members.
|
|
|
|
|
What free Software and DLL's are available to make a free direct connection to a mobile phone to deliver a text message from an internet connection
Bram van Kampen
|
|
|
|
|
|
Hello ,
I am a new in MFC c++ Programming.I am working in VS2010 ,There are two dialog windows one is main dialog and other is sub dialog window .I am not geeting how to close only sub dialog window without closing the main window.
I have tried Enddialog() and DestroyWindow() but it close the both two windows .
Any help??
|
|
|
|
|
Member 13128005 wrote: Any help?? You need to show your code, we cannot guess what it is doing.
|
|
|
|
|
How is the second dialog being created? Is it modal or modeless?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Is your Dialog Modal?
Bram van Kampen
|
|
|
|
|
Hi,
I need help in solving the Linked List K reverse linked list problem.
Given a singly linked list and an integer K, reverses the nodes of the
list K at a time and returns modified linked list.
NOTE : The length of the list is divisible by K
Example :
Given linked list 1 -> 2 -> 3 -> 4 -> 5 -> 6 and K=2,
You should return 2 -> 1 -> 4 -> 3 -> 6 -> 5
Try to solve the problem using constant extra space.
Can anyone point me in the right direction?
Thanks.
|
|
|
|
|
The right direction is forward.
Using an array of K pointers would make the trick.
|
|
|
|
|
CPallini wrote: Using an array of K pointers
Wouldn't that break the condition to only use a constant amount of extra space (assuming this refers to memory usage)?
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Yes, you are right.
I was focused on the space complexity related to the list length. I see my assumption the 'the algo is O(1)' only holds if K is a constant.
|
|
|
|
|
Try to break the problem into sub-problems. For example:
- Given a singly-linked list of length k, reverse the order of the elements
- Given a singly-linked list of length 2*k, reverse the order of the first k elements, without touching the last k elements. Return a pointer to the kth element (counting from zero).
- Given a singly-linked list of length 2*k, reverse the order of the last k elements.
- Given a singly-linked list of length 3*k, reverse the order of the middle k elements. return a pointer to the 2*kth element (counting from zero).
- Put everything together to get the solution to your problem.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|