lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Ang: Re: Bare Metal / Memory Alignment


From: ake . forslund
Subject: [lwip-users] Ang: Re: Bare Metal / Memory Alignment
Date: Wed, 7 Sep 2011 17:59:01 +0200

I recently got the impression that structure-packing wasn't mandatory and could be replaced with padding, I'm not at all sure about this so Stick with packing until Kieran or Simon says otherwise.

I've set up packing a bit differently, firstly I don't use bpstruct.h/epstruct.h at all and my compiler hints for packing looks like this

cc.h:

/* Compiler hints for packing structures */
#define PACK_STRUCT_FIELD(x) x
#define PACK_STRUCT_STRUCT 
#define PACK_STRUCT_BEGIN __packed
#define PACK_STRUCT_END



I'm not sure I'm helping at all, but I like to try anyway =)

/Åke



-----------------------------
Åke Forslund
0433-273296
NIBE AB
Box 14
S-285 21 Markaryd
Tel +46-(0)433-273296


address@hidden skrev: -----
Till: Mailing list for lwIP users <address@hidden>
Från: Jens Breuer
Sänt av: address@hidden
Datum: 2011-09-07 16:16
Ärende: Re: [lwip-users] Bare Metal / Memory Alignment

Hi Ake,

> My Target cpu is an Atmel AT91SAM9261 (ARM9), and I haven't seen any problems like the one you described. I'm not sure I had exactly the same problems but when I started to work with lwip it discarded packages due to missing settings for packing structs.

The target device I am using is STM32F107VC.

As explained there are no other errors so far. At least none that I am
aware of at this time. However I am still quite at the beginning.
Next I'm going to get TCP and UDP included and test that.

> Are you using packed structs or ETH_PAD_SIZE set to some value? Just guesses from the top of my head.

Yes, I use packed structs. I thought, that it would be mandatory.
These are the related defines in cc.h:
===3<===
#define PACK_STRUCT_USE_INCLUDES
#define PACK_STRUCT_FIELD(x)    x
#define PACK_STRUCT_STRUCT
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_END
===3<===

This is the content of bpstruct.h:
===3<===
#pragma push
#pragma pack(1)
===3<===

This is the content of epstruct.h:
===3<===
#pragma pop
===3<===

ETH_PAD_SIZE is not defined in my case. It is using the default from opt.h of 0.
I set it to 2 some time, but I realized quickly that lwIP then uses
the wrong data as the type field value (misalign by 2, surprise).

However, I still have the feeling that I am just doing something wrong...

@Kieran & Ake: Thanks for your replies and interest in the problem.

Kind regards
Jens

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

[Prev in Thread] Current Thread [Next in Thread]